#include <iostream>

using namespace std;

int main()
{

    int income,expense,month,tmp,cost;
    bool f;

    while(true){
        cin >> cost;
        if(cost == 0){
            break;
        }

        tmp = 0;
        f = false;
        month = 0;

        for(int i = 0; i < 12; ++i){
            income = 0;
            expense = 0;

            cin >> income >> expense;

            tmp += (income - expense);
//            cout << tmp << endl;
            if(tmp >= cost && !f){
                month = i+1;
                f = true;
//                cout << month << endl;
            }
        }

        if(month == 0){
            cout << "NA" << endl;
        }
        else{
            cout << month << endl;
        }
    }

}