#include <iostream>

int main() {
	int l;
	std::cin >> l;
	while (l != 0) {
		int num = 0;
		for (int m, n, i = 1; i < 13; ++i) {
			std::cin >> m >> n;
			l -= m - n;
			if (l <= 0 && num == 0) {
				num = i;
			}
		}
		if (num == 0) {
			std::cout << "NA\n";
		}
		else {
			std::cout << num << "\n";
		}
		std::cin >> l;
	}
	return 0;
}