#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)

int main() {
	int L;
	
	while (cin >> L, L) {
		int sum = 0, ans = -1;
		
		for_(i,0,12) {
			int M, N;
			cin >> M >> N;
			sum += (M - N);
			if (sum >= L && ans == -1) ans = i + 1;
		}
		
		if (ans == -1) puts("NA");
		else cout << ans << endl;
	}
}