#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <cmath>
#include <queue>

using namespace std;

int main(){
	
	int L;
	
	while(true){
		
		cin >> L;
		if(L == 0){
			break;
		}
		
		int ans = 0;
		bool check = true;
		
		for(int i = 0; i < 12; i++){
			int M, N;
			cin >> M >> N;
			L -= (M - N);
			if(check && L <= 0){
				check = false;
				ans = i + 1;
			}
		}
		
		if(check){
			cout << "NA" << endl;
		}else{
			cout << ans << endl;
		}
		
	}
	
	return 0;
}