#include <iostream>
using namespace std;

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

	return 0;
}