#include <cstdio>
#include <iostream>
#include <stdlib.h>
#include <iomanip>
#include <string> 
#include <sstream>  
#include <vector> 
#include <time.h>
#include <algorithm>
using namespace std;

int main(){
    int P;
    while(cin >> P){
        if(P == 0)break;
        int Money  = 0,answer = 0;
        int M,N;
        for(int i = 1;12 >= i;i++){cin >> M >> N;Money += M - N;if(Money >= P and answer == 0){answer = i;}}
        if(answer == 0){
            cout << "NA" << endl;
        }else{
            cout << answer << endl;
        }
    }
}  