#include<iostream>

using namespace std;


int main(void)
{
	int M[12] = {0};
	int N[12] = {0};
	int L = 0;
	
	while (true)
	{
		int ans = 0;

		cin >> L;
		if (L == 0)	{	return 0; }


		int i = 0;

		for (i = 0; i < 12; i++)
		{
			cin >> M[i] >> N[i];
		}

		for (i = 0; i < 12; i++)
		{
			if (L <= 0)
			{
				break;
			}
			ans++;
			L = L + N[i] - M[i];
		}

		if (i == 12 && L > 0)
		{
			cout << "NA" << endl;
			continue;
		}

		cout << ans << endl;
	}

	return 0;
}