#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <limits>
#include <sstream>

using namespace std;

int main (void)
{
	for (long u = 0; u < 1000; u++)
	{
		long long n;
		long a[13],b[13];

		cin >> n;
		if (n == 0)
		{
			break;
		}

		for (int i = 0; i < 12; i++)
		{
			cin >> a[i] >> b[i];
		}

		int p = 0;

		for (int i = 0; i < 12; i++)
		{
			p += a[i] - b[i];
			if (p >= n)
			{
				cout << i + 1 << endl;
				break;
			}
			if (i == 11)
			{
				cout << "NA" << endl;
				break;
			}
		}
	}
}
