#include <iostream>
using namespace std;

int main() {
	int i, L, M, N, sum = 0;
	
	for(;;){
		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(sum < L)
			cout << "NA"<< endl;
		else 
			cout << i << endl;
		
	}
	return 0;
}