#include<iostream>
using namespace std;

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