#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<char, int>P;

int main(){
	int l;
	while (cin >> l, l) {
		int cnt = 0;
		int ans = -1;
		rep(i, 12) {
			int m, n; cin >> m >> n;
			cnt += m - n;
			if (!~ans&&l <= cnt)ans = i + 1;
		}
		printf(~ans ? "%d\n" : "NA\n", ans);
	}
	return 0;
}