#include <cstdio>

#define REP(a, n) for (int i = (a); i < n; i++)

using namespace std;

int main()
{
  int l, m, n;
  
  while (scanf("%d", &l), l != 0){
    int sum = 0, month = 1;
    bool flag = true;
    REP(0, 12){
      scanf("%d%d", &m, &n);
      sum += m - n;
      if (sum >= l) flag = false;
      if (flag) month++;
    }
  
    if (month <= 12) printf("%d\n", month);
    else printf("NA\n");
  }

  return (0);
}