#include<iostream>
using namespace std;
int sum, n, a, b, ok;
int main() {
	while (true) {
		sum = 0;
		ok = 0;
		cin >> n;
		if (n == 0) { break; }
		for (int i = 0; i < 12; i++) {
			cin >> a >> b;
			sum += a - b;
			if (sum >= n && ok == 0) { cout << i << endl; ok = 1; }
		}
		if (ok == 0) { cout << "NA" << endl; }
	}
}