#include<iostream>
using namespace std;
int main(){
	int n,a,b,ans;
	while(cin>>n,n){
		ans=-1;
		for(int i=1;i<=12;i++){
			cin>>a>>b;
			n -= a-b;
			if(ans==-1 && n<=0)ans=i;
		}
		if(ans!=-1)cout<<ans<<endl;
		else cout<<"NA\n";
	}
}