#include <iostream>
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
using namespace std;
int main(){
	int n,a[12],b[12];
	while(cin >> n, n) {
		int m = 0;
		rep(i,12) {
			cin >> a[i] >> b[i];
		}
		rep(i,12) {
			m += a[i]-b[i];
			if(m>=n) {
				cout << i+1 << endl;
				break;
			}
		}
		if(m<n) cout << "NA" << endl;
	}
}