#include <iostream>
using namespace std;

int main(){
	int shotoku[12];
	int l,m,n;
	int i,total;
	while(cin>>l,l){
		for(i=0;i<12;i++){
			cin>>m>>n;
			shotoku[i]=m-n;
		}
		total=0;
		for(i=0;i<12;i++){
			total+=shotoku[i];
			if(l<=total){
				cout<<i+1;
				break;
			}
		}
		if(i==12) cout<<"NA";
		cout<<endl;
	}
	return 0;
}