#include <iostream>
using namespace std;

int main(void) {
	int L, M, N;

	while(cin >> L, L) {
		int sum = 0;
		bool flag = true;

		for(int i = 0; i < 12; i++) {
			cin >> M >> N;
			sum += M - N;

			if(sum >= L && flag) {
				cout << i + 1 << endl;
				flag = false;
			}
		}

		if(flag)
			cout << "NA" << endl;
	}
}