#include <stdio.h>

#define MONTHS 12

int main(void){
	int l;
	int m, n, ok;
	
	while (scanf("%d", &l), l){
		ok = -1;
		for (int i=1; i<=MONTHS; i++){
			scanf("%d%d",&m,&n);
			l -= (m-n);
			if (ok<0 && l<=0) ok = i;
		}
		if (ok==-1) puts("NA");
		else printf("%d\n", ok);
	}
	return 0;
}