#include <iostream>
using namespace std;

int main(){
	long long int price,a,b,n,month;
	bool judge;
	while(cin >> n && n){
		price = 0;
		judge = false;
		for(int i = 0;i< 12 ;i++){
			cin >> a >> b;
			price += (a-b);
			if(price >= n && judge == false) {
				month = i + 1;
				judge = true;
			}
		}
		if(judge == true) cout << month << endl;
		else cout << "NA" << endl;
	}
	return 0;
}