#include <bits/stdc++.h>

using namespace std;

int main()
{
    int L, M, N;
    while (cin >> L, L) {
        int sum = 0, j = -1;
        for (int i = 0; i < 12; i++) {
            cin >> M >> N;
            sum += (M - N);
            if (j == -1 && sum >= L) {
                j = i;
            }           
        }
        if (j >= 0) {
            cout << j+1 << endl; 
        } else {
            cout << "NA" << endl;
        }
    }
    return 0;
}