#include<iostream>
using namespace std;
int main() {
	int money;
	while (cin >> money&&money != 0) {
		int get[12], use[12];
		for (int i = 0; i < 12; ++i) {
			cin >> get[i] >> use[i];
		}
		int ans = -1;
		int num = 0;
		for (int i = 0; i < 12; ++i) {
			num += get[i] - use[i];
			if (num >= money) {
				ans = i + 1;
				break;
			}
		}
		if (ans != -1) {
			cout << ans << endl;
		}else{
			cout << "NA" << endl;
		}
	}
	return 0;
}