#include <cstdio>

int n;

int main(){
	while(scanf("%d", &n),n){
		int in, out, month = 0;
		bool ok = true;
		for(int i = 0; i < 12; i++){
			scanf("%d%d", &in, &out);
			n -= in-out;
			if(n <= 0 && month == 0) month = i+1;
		}
		if(n <= 0) printf("%d\n", month);
		else printf("NA\n");
	}
}