#include <cstdio>
#define rep(i, n) for (int i = 0; i < (n); ++i)
int main()
{
    int m, n, l, s, f, res;
    while (true) {
        scanf("%d", &l); if (l == 0) break;
        s = f = 0;
        rep(i, 12) {
            scanf("%d%d", &m, &n);
            s += (m - n);
            if (!f && s >= l) { res = i+1; f = 1; }
        }
        if (!f) puts("NA"); else printf("%d\n", res);
    }
    return 0;
}