#include <iostream>
using namespace std;

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