#include <iostream>
using namespace std;

int main() {
  int L,M,N;
  int sum,ans;
  while(cin >> L) {
    if(L==0) break;
    sum=0;
    bool r = true;
    for(int i=0;i<12;i++) {
      cin >> M >> N;
      sum += M-N;
      if(sum >= L && r) {
        ans = i+1;
        r = false;
      }
    }
    if(!r)
      cout << ans << endl;
    else
      cout << "NA" << endl;
  }
}