#include <iostream>
using namespace std;

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