#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
using namespace std;

#define rep(i,a) for(int i=0;i<(a);++i)

int main()
{
    int L, M, N, sum;
    while(cin >> L && L) {
        bool ok = false;
        sum = 0;
        rep(i, 12) {
            cin >> M >> N;
            sum += M - N;
            if(!ok && sum >= L) {
                cout << i + 1 << endl;
                ok = true;
            }
        }
        if(!ok) 
            cout << "NA" << endl;
    }
}