#include <bits/stdc++.h>

using namespace std;

int main()
{   
    int TripCost;
    while (cin >> TripCost) {
        if (TripCost == 0) break;
        
        int TripSum = 0;
        pair<bool, int> DataBase(false, 0);
        bool is_judge = true;
         
        
        for (int i = 0; i < 12; ++i) {
            int data1, data2;

            cin >> data1 >> data2;
            
            TripSum += data1 - data2;

            
            
            if (TripSum >= TripCost && is_judge) {
                DataBase.first = true;
                DataBase.second = i + 1;
                is_judge = false;
            } 
        }
        
        if (DataBase.first) {
            cout << DataBase.second << endl;
        } else {
            cout << "NA" << endl;}
    }
    
    return 0;
}