#include <iostream>
using namespace std;

int main()
{
	int N;
	int h[12],L[12];
	while (cin >> N) {
		if (N == 0)
			break;
		for (int i = 0; i < 12; i++) {
			cin >> h[i]>>L[i];
		}
		int cont = 0;
		for (int i = 0; i < 12; i++) {
			cont += h[i] - L[i];
			if (cont >= N) {
				cout << i+1 << endl;
				break;
			}
		}
		if (cont < N)
			cout << "NA" << endl;
	}
	return 0;
}