#include <iostream>
using namespace std;

int main() {
    int L, m, n, brk, i, j;
    while (cin >> L && L) {
        brk = -1;
        for (i=1; i<13; i++) {
            cin >> m >> n;
            L -= m - n;
            if (L <= 0 && brk == -1) {
                brk = i;
            }
        }
        if (brk == -1) {
            cout << "NA" << endl;
        } else {
            cout << brk << endl;
        }
    }
    return 0;
}