#include <bits/stdc++.h>
using namespace std;

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