#include <iostream>

using namespace std;

int main() {
    int L;
    while (cin >> L) {
        if (L == 0) break;
        for (int i = 1; i <= 12; i++) {
            int M, N; cin >> M >> N;
            L -= (M - N);
            if (L <= 0) {
                cout << i << endl;
                for (int j = i+1; j <= 12; j++) {
                    int t1, t2; cin >> t1 >> t2;
                }
                break;
            }
            if (i == 12)
                cout << "NA" << endl;
        }
    }
    return 0;
}