#include <iostream>

using namespace std;

int main()
{
    int L;

    while (cin >> L, L) {
        int M, N;
        int ans = 0;

        for (int i = 0; i < 12; i++) {
            cin >> M >> N;
            L -= (M - N);
            if (L <= 0 && ans == 0) 
                ans = i + 1;
        }
        if (ans == 0)
            cout << "NA" << endl;
        else
            cout << ans << endl;
    }

    return 0;
}