#include<iostream>
using namespace std;

int main(){
	long long int l, m, n;
	long long int savingMoney;
	bool output = true;

	while(cin >> l, l){
		savingMoney = 0;
		output = true;
		for(int i=1; i <= 12; i++){
			cin >> m >> n;
			savingMoney += m - n;

			if(l <= savingMoney && output){
				cout << i << endl;
				output = false;
			}
			if(i == 12 && savingMoney < l){
				cout << "NA" << endl;
			}
		}

	}
}