#include <cstdio>

using namespace std;

int main(void){
	int m, n, s, l, ans, i;
	while(1){
		scanf("%d",&l);
		if(l == 0){
			break;
		}
		s = ans = 0;
		for(i = 1;i <= 12;i++){
			scanf("%d%d",&m,&n);
			s += m - n;
			if(ans == 0 && s >= l){
				ans = i;
			}
		}
		if(ans != 0){
			printf("%d\n",ans);
		}else{
			printf("NA\n");
		}
	}
	return 0;
}