#include <iostream>
#include <vector>
using namespace std;
int main(void)
{
	int cost,saving;
	vector< vector<int> > money(12,vector<int>(2));
	while(1){
		cin >> cost;
		if(cost==0) break;
		saving=0;
		for(int i=0;i<12;i++){
			cin >> money[i][0] >> money[i][1];
		}
		for(int i=0;i<12;i++){
			saving+=(money[i][0]-money[i][1]);
			if(cost<=saving){
				cout << i+1 << endl;
				break;
			}
		}
		if(saving<cost) cout << "NA" << endl;
		money.clear();
	}
	return 0;
}