#include <iostream>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	int L;
	while(cin >> L , L){
		int sum = 0 , ans = -1;
		rep(i,12){
			int a,b;
			cin >> a >> b;
			sum += a - b;
			if(!~ans && sum >= L) ans = i+1;
		}
		if(~ans)cout << ans << endl;
		else cout << "NA" << endl;
	}
}