#include <iostream>
using namespace std;

int main() {
    while (true) {
        int L;
        cin >> L;
        if (L == 0) {
            break;
        }
        int saving = 0;
        int result = 0;
        for (int i = 0; i < 12; i++) {
            int M, N;
            cin >> M >> N;
            saving += M - N;
            if (L < saving && result == 0) {
                result = i + 1;
            }
        }
        if (result > 0) {
            cout << result << endl;
        } else {
            cout << "NA" << endl;
        }
    }
}