#include<stdio.h>

int main(void){
	int L,M,N,k,i;
	while(scanf("%d",&L)!=EOF){
		k=0;
		for(i=1;i<13;i++){
		  scanf("%d %d",&M,&N);
		  L-=M-N;
		  if(L<=0){ 
			  k=i;
			  L=10000000000;
		  }
		}
      if(k==0) printf("NA\n");
	  else printf("%d\n",k);
	}
  return 0;
}