#include<iostream>
using namespace std;

int main(){
    int n;
    while(cin >>n){
        if(n == 0) break;
        int i, ans = -1;
        bool fnd = false;
        for(i = 1; i <= 12; i++){
            int a, b; cin >>a >>b;
            n -= (a - b);
            if(n <= 0 && fnd == false){
                ans = i;
                fnd = true;
            }
        }
        if(fnd == false) cout <<"NA" <<endl;
        else cout <<ans <<endl;
    }
    return 0;
}