#include <iostream>
using namespace std;
 
int main() {
	while(1){
		int l;
		cin>>l;
		if(l==0){break;}
		int a=0;
		int i =1;
		int ans=1;
		while(i<=12){
			int p,o;
			cin>>p>>o;
			a=a+p-o;
			if(a<l){ans++;}
			i++;
		}
		if(a>=l){cout<<ans<<endl;}
		else{cout<<"NA"<<endl;}
	}
	return 0;
}