#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int l;
    while(cin >> l, l){
        int sum = 0, ans = -1;
        rep(i,12){
            int m,n;
            cin >> m >> n;
            sum+= (m - n);
            if(l <= sum && ans == -1){
                ans = i + 1;
            }
        }
        if(ans == -1) cout << "NA" << endl;
        else cout << ans << endl;
    }
}