#include <iostream>
using namespace std;

int money(int n){
	int month[12];
	int sum = 0;
	for(int i=0; i<12; ++i){
		int a,b;
		cin >> a >>b;
		sum += a-b;
		if(sum >= n){
			return i+1;
		}
	}
	return 0;
}

int main(){
	int n;
	int result;
	while(cin >> n&& n){
		result = money(n);
		if(result == 0){
			cout << "NA" << endl;
		} else {
			cout << result << endl;
		}
	}
	return 0;
}