#include<iostream>
#include<vector>
#include<math.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;


const int END_OF_INPUT = 0;


int main() {
	int l;
	while (cin >> l && l != 0){
		int m, n;
		int total_money = 0;
		int achieve_month = 0;
		bool  isAchieved = false;
		for (int i = 0; i < 12; ++i){
			cin >> m >> n;
			total_money += (m - n);
			if (total_money >= l && isAchieved == false){
				achieve_month = (i + 1);
				cout << achieve_month << endl;
				isAchieved = true;
			}
		}
		if (achieve_month == 0){
			cout << "NA" << endl;
		}

	}
	


	


}