
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

int main()
{
	int L;
	while (cin >> L, L) 
	{
		ll sum = 0,ans=0;
		bool flag = false;
		for (int i = 0; i < 12; i++)
		{
			int M, N;
			cin >> M >> N;
			sum += M - N;
			if (sum >= L && !flag)
			{
				ans = i + 1;
				flag = true;
			}
		}
		if (!flag)cout << "NA" << endl;
		else cout << ans << endl;
	}
	return 0;
}