#include <iostream>
using namespace std;

int main() {
    int L;

    while (cin >> L, L) {
        int month = 0, savings = 0, M, N;
        for (int i = 0; i < 12; i++) {
            cin >> M >> N;
            savings += M - N;
            if (month == 0 && L <= savings) month = i + 1;
        }
        if (month > 0) {
            cout << month << endl;
        }
        else {
            cout << "NA" << endl;
        }
    }
    return 0;
}