#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define alint(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	while(1){
		int l,sum=0,ans=0;
		cin>>l;
		if(l==0) break;
		vi m(12),n(12);
		rep(i,0,12){
			cin>>m[i]>>n[i];
		}
		rep(i,0,12){
			sum+=m[i]-n[i];
			if(sum>=l){
				ans=i+1;
				break;
			}
		}
		if(ans==0) o("NA");
		else o(ans);
	}
}