#include <cstdio>

using namespace std;

int main(){
	while(true){
		int L;
		scanf("%d", &L);
		if(L == 0){ break; }
		int answer = 0, sum = 0;
		for(int i = 1; i <= 12; i++){
			int M, N;
			scanf("%d%d", &M, &N);
			sum += (M - N);
			if(answer == 0 && sum >= L){ answer = i; }
		}
		if(answer == 0){
			puts("NA");
		}else{
			printf("%d\n", answer);
		}
	}
	return 0;
}