//Next Trip
#include <iostream>

using namespace std;

int main(){
	int aimL;//旅行費用
	int nowL;//現在貯蓄
	int M, N;//貯蓄額/出費額
	bool isoutput;
	while (1){
		cin >> aimL;
		if (aimL == 0)break;

		nowL = 0;
		isoutput = false;
		for (int i = 0; i < 12; ++i){
			cin >> M >> N;
			nowL += (M - N);
			if (nowL >= aimL && !isoutput){
				cout << (i + 1) << endl;
				isoutput = true;
			}
		}
		if (!isoutput)cout << "NA" << endl;
	}


	return 0;
}