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