#include <iostream>
using namespace std;

int main(){
	int L;
	while(cin >> L && L){
		int ok = 0 , oktime = 1e9;
		for(int i = 1 ; i <= 12 ; i++){
			int M,N;
			cin >> M >> N;
			ok += M - N;
			if( ok >= L ) oktime = min(oktime,i);
		}
		if( oktime > 1000 ) cout << "NA" << endl;
		else cout << oktime << endl;
	}
}