#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

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