#include<iostream>

int l, m, n, money = 0, month;

int main(){
	while(true){
		std::cin >> l;
		if(!l)
			return 0;
		for(int i=0; i<12; i++){
			std::cin >> m >> n;
			money += m-n;
			if(money >= l && !month)
				month = i+1;
		}
		if(!month)
			std::cout << "NA" << std::endl;
		else
			std::cout << month << std::endl;
		money = 0;
		month = 0;
	}
}