#include <iostream>
using namespace std;

int main(){
    int l;
    int chokin = 0;
    int tmp;
    int m;
    int n;
    bool flug = false;
    int month;

    while(cin >> l, l != 0){
        chokin = 0;
        flug = false;
        month = 0;
        for(int i=1; i<=12; i++){
            cin >> m >> n;
            if(flug == false){
                tmp = m - n;
                chokin += tmp;
                if(chokin >= l){
                    flug = true;
                    month = i;
                }
            }
        }
        if(flug == true){
            cout << month << endl;
        }else{
            cout << "NA" << endl;
        }
    }

    return 0;
}