#include<bits/stdc++.h>

using namespace std;

int main() {
	int l, m, n, sum, i;
	bool flag;

	while (cin >> l, l) {
		sum = 0;
		flag = true;
		for (i = 1; i < 13; ++i) {
			cin >> m >> n;
			sum += m - n;
			if (flag && sum >= l) {
				l = i;
				flag = false;
			}
		}
		if (flag) {
			cout << "NA" << endl;
		}
		else {
			cout << l << endl;
		}
	}

	return 0;
}
