#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
  int n;
  while (scanf("%d ", &n) == 1) {
    if (n == 0) {
      break;
    }
    for (int i = 1; i <= 12; i++) {
      int a, b;
      scanf("%d %d ", &a, &b);
      n -= a - b;
      if (n <= 0) {
	cout << i << endl;
	goto next;
      }
    }
        cout << "NA" << endl;
  next:;
  }
  return 0;
}