#include<iostream>
#include<vector>
using namespace std;

int main() {
	while (1) {
		int a;
		cin >> a;
		if (a == 0)break;
		vector<int>s(12);
		for (int b = 0; b < 12; b++) {
			int c, d;
			cin >> c >> d;
			s[b] = c - d;
			if (a <= 0) {
				cout << b + 1 << endl; break;
			}
		}
		for (int f = 0; f < 12; f++) {
			a -= s[f];
			if (a <= 0) { cout << f + 1 << endl; break; }
			if (f == 11) { cout << "NA" << endl; break; }
		}
	}
}