#include <iostream>
using namespace std;

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