#include <iostream>

using namespace std;

int main(){
	int m,n,l,f,sum,ans;
	while(cin>>l){
	if(l==0)break;
	sum=0;
	ans=-1;
	for(int i=1;i<=12;i++){
	cin>>m>>n;
	sum+=m-n;
	if(l<=sum&&ans==-1)ans=i;
	}
	if(ans==-1)cout<<"NA"<<endl;
	else cout<<ans<<endl;
}
}