#include <iostream>

using namespace std;

static const int MAX_L = 1000000;
static const int MAX_M = 100000;
static const int MAX_N = 100000;

int main(int argc, char** argv)
{
	int L, M, N;
	int c, save;
	bool is_ok;

	while( 1 )
	{
		cin >> L;
		if(L==0) break;
		
		save = 0;
		c = 0;
		is_ok = false;
		for(int i=0; i<12; i++)
		{
			cin >> M;
			cin >> N;
			save += M - N;

			if(save >= L)
			{
				if(!is_ok) c = i+1;
				is_ok = true;
			}
		}

		if(is_ok) cout << c << endl;
		else cout << "NA" << endl;
	}

	return 0;
}