#include <iostream>
#include <vector>

using namespace std;

void solve()
{
	int price;
	while(cin >> price, price)
	{
		vector<int> Vec;
		for(int i = 0; i < 12; ++i)
		{
			int in, out;
			cin >> in >> out;
			Vec.push_back(in - out);
		}
		bool endFlag = false;
		int sum = 0;
		for(int i = 0; i < 12; ++i)
		{
			sum += Vec[i];
			if(sum >= price)
			{
				cout << i + 1 << endl;
				endFlag = true;
				break;
			}
		}
		if(!endFlag)
		{
			cout << "NA" << endl;			
		}
	}
}

int main()
{
	solve();
	return(0);
}