#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
    int L;
    while (cin >> L, L) {
        vector<int> M(12), N(12);
        for (int i=0; i<12; ++i) {
            cin >> M[i] >> N[i];
        }
        int month = -1, sum = 0;
        for (int i=0; i<12; ++i) {
            sum = sum + M[i] - N[i];
            if (L <= sum) {
                month = i+1;
                break;
            }
        }
        if (month < 0) {
            cout << "NA" << endl;
        } else {
            cout << month << endl;
        }
    }
    return 0;
}