#include <iostream>
#include <sstream>

using namespace std;

int main(){
	int i;
	string month;
	long int cost,sum,income,outcome;
	while(cin >> cost && cost != 0){
//		cout << cost;
		int sum = 0;
		bool flag = 1;
		for(i=0;i<12;i++){
			cin >> income >> outcome;
			sum += income - outcome;
			if(sum >= cost && flag){
				stringstream tuki;
				tuki << i+1;
				month = tuki.str();
				flag = !flag; 
			}
		}
		if(flag) month = "NA";
		cout << month << endl;
	}


}