#include<iostream>

int main(){

	int l;
	while (std::cin >> l){

		if (l == 0)break;

		bool flg = true;
		for (int i = 1, m, n; i <= 12; i++){
			std::cin >> m >> n;
			l -= (m - n);

			if (flg&&l <= 0)std::cout << i << std::endl, flg = false;
			if (i == 12 && l > 0)std::cout << "NA" << std::endl;
		}
	}

	return 0;
}