#include <cstdio>
using namespace std;

int main(){
	int s;
	while(scanf("%d", &s), s){
		int x, y;
		int ans = -1;
		for(int i = 1; i <= 12; ++i){
			scanf("%d%d", &x, &y);
			s -= x - y;
			if(s <= 0 && ans == -1){
				ans = i;
			}
		}
		printf(ans == -1 ? "NA\n" : "%d\n", ans);
	}
}