// AOJ0206.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//

#include <iostream>

using namespace std;


int main()
{
	int l = 0, m = 0, n = 0, cash = 0, ans = 0;
	cin >> l;
	while (l){
		for (int i = 1; i <= 12; i++){
			cin >> m >> n;
			cash += m - n;
			if (cash >= l){
				ans = i;
				break;
			}
		}
		if (ans){
			cout << ans << endl;
			for (int i = ans; i <= 12; i++){
				cin >> m >> n;
			}
		} else{
			cout << "NA" << endl;
		}
		m = n = cash = ans = 0;
		cin >> l;
	}
	return 0;
}