#include<iostream>

using namespace std;
int main(void){

	int L,M,N,wa=0,mo=-1;
	while(1){
		wa=0,mo=-1;
		cin>>L;
		if(L==0) break;
		for(int i=1;i<=12;i++){
			cin>>M>>N;
			wa+=M-N;
			if(wa>=L&&mo==-1) mo=i;
		}
		if(mo!=-1) cout<<mo<<endl;
		else cout<<"NA"<<endl;
	}
	return 0;
}