#include <cstdio>
#include <iostream>
using namespace std;

int main()
{
  int L, M, N;
  
  while (scanf("%d", &L), L){
    int sum = 0, reach;
    bool check = true;
    for (int i = 0; i < 12; i++){
      scanf("%d%d", &M, &N);
      sum += M - N;
      if (check && sum >= L){
        reach = i + 1;
        check = false;
      }
    }
    if (!check){
      printf("%d\n", reach);
    }
    else {
      printf("NA\n");
    }
  }

  return (0);
}