#include<iostream>

using namespace std;

int main() {
  int n,m,nn,mm,x,p;
  while(cin >> x){
    if(x==0){break;}
  p=0;
  for(int i =0;i<12;i++){
    cin >>n>>m;
    nn += n;
    mm += m;
    if (nn-mm>=x){
      p = i+1;
    }
  }
  if(p==0){cout << "NA" << endl;}else{cout << p << endl;}
  }
  return 0;
}

