#include <cstdio>
using namespace std;

int main() {

    int L, m, n, res;

    for (; ;) {
        scanf("%d", &L);
        res = -1;
        if (L == 0) break;
        for (int i = 0; i < 12; i++) {
            scanf("%d %d", &m, &n);
            L-= m-n;
            if (L <= 0 && res < 0) res = i+1;
        }
        (L > 0) ? printf("NA\n") : printf("%d\n", res);
    }
    return 0;
}

