#include <iostream>
#include <cstdio>

using namespace std;

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