#include <iostream>
using namespace std;

int main(){
	int L;
	while(cin >> L && L){
		int last = 0 , f = 0;
		for(int i = 1 ; i <= 12 ; i++){
			int a,b;
			cin >> a >> b;
			int c = a-b;
			last += c;
			if( last < L ){
				f = i;
			}
		}
		if( last < L ){
			cout << "NA" << endl;
		}else{
			cout << f+1 << endl;
		}
	}
	
}