#include<iostream>
using namespace std;
int main(){
 
  int cost,M,N;
  while(1){
    int sum=0,buf=0;
    
    cin >> cost;
    if(cost ==0)break;
    for(int i=0;i<12;i++){
      cin>>M>>N;
      sum+=(M-N);
      if(sum>=cost && buf==0){
	buf=i+1;
      }
    }
    if(buf==0) cout<<"NA"<<endl;
    else cout<<buf<<endl;
  }
  return 0;
}