#include<iostream>
using namespace std;
int main()
{
	int L, M, N, sum, i, k;
	while(1)
	{	
		cin >> L;
		if ( L == 0 )break;
		else
		{
			k = 0;
			sum = 0;
			for ( i = 0; i < 12; i++ )
			{
				cin >> M >> N;
				sum = (sum + (M - N));
				if ( sum < L )k++;
			}
			k = k + 1;
			if ( sum < L )cout << "NA" << endl;
			else cout << k << endl;
		}
	}	
	return 0;
}