#include <iostream>
using namespace std;

int main()
{
	int l;

	cin >> l;

	while (l) {
		int t = 0, r = -1;

		for (int i = 0; i < 12; i++) {
			int m, n;
			cin >> m >> n;

			t += m - n;

			if (t >= l && r < 0)
				r = i + 1;
		}

		if (r > 0)
			cout << r << endl;
		else
			cout << "NA" << endl;

		cin >> l;
	}

	return 0;
}
