#include	<iostream>

using namespace std;

int main(void) {
	while(1) {
		int L, mt = 0;
		int gL = 0;
		
		cin >> L;
		if( L == 0 )	break;
		
		for(int i = 0; i < 12; i++) {
			int n, m;
			cin >> n >> m;
			gL += n - m;
			if(gL >= L && mt == 0) {
				mt = i + 1;
			}
		}
		
		if(mt == 0) {
			cout << "NA" << endl;
		} else {
			cout << mt << endl;
		}
	}
}