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


int main(){
	while(1){
	int a,flag =0,g = 0;
	cin >> a;
	int b = 0;
	for(int i=1;i <=12;i++){
		int c,d;
		cin >>c >> d;
		b = b +c -d;
		if(b >= a){
			if(flag == 0){
			g = i;
			flag = 1;
			}
		}
		if(i == 12)break;
	}
	if(flag == 1) cout << g << endl;
		if(flag == 0)cout << "NA" << endl;
	

	}


		return 0;

}