#include<iostream>
using namespace std;

int L,M,N,tmp,ans;

int main(){
	while(true){
		cin >> L;
		if(!L)
			return 0;
		tmp = 0;
		ans = 0;
		for(int i=0; i<12; i++){
			cin >> M >> N;
			tmp += M-N;
			if(tmp >= L && !ans)
				ans = i+1; 
		}
		if(ans)
			cout << ans << endl;
		else
			cout << "NA\n";
	}
}