#include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstdlib>
using namespace std;

int main(){
	int l;
	while(scanf("%d",&l)==1,l){
		int m,n,sum=0,month=-1;
		for(int x=0;x<12;++x){
			scanf("%d %d",&m,&n);
			sum += m-n;
			if(sum>=l && month==-1)month=x+1;
		}
		if(month==-1)cout<<"NA"<<endl;
		else cout<<month<<endl;
	}
	return 0;
}