#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	int L,M,N;
	while(cin>>L&&L!=0){
		int ac=-1;
		int sum=0;
		bool f=false;
		for(int i = 0; i < 12; i++){
			int a,b;
			cin>>a>>b;
			sum+=a-b;
			if(sum>=L&&!f){
				ac=i;
				f=true;
			}
		}
		if(ac!=-1)
			cout<<ac+1<<endl;
		else
			cout<<"NA"<<endl;
	}
	return 0;
}