#include <stdio.h>
#include <iostream>

using namespace std;

int main() {
	int L,M,N;
	int kari;
	int meter;
	int i;
	int data;

	while (cin >> L) {
		if (L == 0) {
			break;
		}
		meter = 0;
		for (i = 0; i < 12; i++) {
			cin >> M >> N;
			kari = M - N;
			L -= kari;
			if (L <= 0 && meter == 0) {
				meter = 1;
				data = i+1;
			}
		}

		if (meter == 1) {
			cout << data << endl;
		} else {
			cout << "NA" << endl;
		}
	}
	return 0;

}