#include<bits/stdc++.h>
using namespace std;
main(){
  int m,n,l,day,sum;
  while(1){
    cin>>l;
    if(l==0)break;
    day=0;
    sum=0;
    for(int i=0;i<12;i++){
      cin>>m>>n;
      if(day!=0)continue;
      sum+=m-n;
      if(sum>=l){
	day=i+1;
      }
    }
    if(day!=0){
      cout<<day<<endl;
    }
    else{
      cout<<"NA"<<endl;
    }
  }
}