#include <iostream>
using namespace std;

int main(){
    long int trip,sui,tou,total,flag;
    while(1){
        total = 0;
        flag = 0;
        cin >> trip;
        if(trip == 0){
            break;
        }
        for(int i=0;i<12;i++){
            cin >> sui >> tou;
            total += sui - tou;
            if(total >= trip){
                cout << i+1 << endl;
                flag = 1;
                break;
            }
        }
        if(flag == 0){
            cout << "NA" << endl;
        }
    }
}