#include<iostream>
using namespace std;
int main(){
long l,m,n,s,i,ii,f;
while(cin>>l){
if(l==0)break;
for(s=ii=f=0,i=0;i<12;i++){
cin>>m>>n;
s+=m-n;
if(f==0&&s>=l){ii=i+1;f=1;}
}
if(ii==0)cout<<"NA"<<endl;
else cout<<ii<<endl;
}
return 0;
}