#include<iostream>

using namespace std;

int main(){
  int cost,m,n;
	while(true){
		bool flag = false;
		cin>>cost;
		if(!cost)break;
		for(int i=0;i<12;i++){
			cin>>m>>n;
			cost -= (m-n);
			if(cost<=0&&!flag){
				cout<<i+1<<endl;
				flag = true;
			}
		}
		if(!flag)
			cout<<"NA"<<endl;
	}
  return 0;
}