#include <iostream>
using namespace std;


int main()
{
	int l, m[12], n[12];
	while (cin >> l && l != 0)
	{
		for (int i = 0; i < 12; i++)
			cin >> m[i] >> n[i];
		for (int i = 0; i < 12; i++)
		{
			l -= (m[i] - n[i]);
			if (l <= 0)
			{
				cout << i + 1 << endl;
				break;
			}
			if (i == 11)
				cout << "NA" << endl;
		}
	}

	return 0;
}