#include <iostream>
using namespace std;
int main()
{
	int l, m, n, s, r, i;
	while (cin >> l && l)
	{
		s = 0;
		r = 0;
		for (i = 0; i < 12; i++)
		{
			cin >> m >> n;
			s += m-n;
			if (!r && s >= l)
				r = i+1;
		}
		if (r == 0)
			cout << "NA" << endl;
		else
			cout << r << endl;
	}
}