#include<iostream>

using namespace std;

int main() {
    int l;
    while(1) {
        cin >> l;
        if (l == 0) break;
        int ac = 0;
        int ans = -1;
        for (int i = 0; i < 12; ++i) {
            int m, n;
            cin >> m >> n;
            ac += m - n;
            // cout << ac << endl;
            if (ac >= l && ans == -1){
                ans = i + 1;
            }
        }
        if (ans == -1) {
            cout << "NA" << endl;
        } else {
            cout << ans << endl;
        }
    }
}
