#include <bits/stdc++.h>

#define loop(v, f, l) for(int v = (f), v##_ = (l); v < v##_; ++v)

using namespace std;

typedef long long int lint;
static inline int in(){ int x; scanf("%d", &x); return (x); }
static inline lint inl(){ lint x; scanf("%lld", &x); return (x); }

int main()
{
	int m, n, l;
	int nowMoney;
	int completeMonth;

	while( 1 )
	{
		l = in();
		if( l == 0 )break;
		
		nowMoney = 0;
		completeMonth = 13;

		loop(i, 0, 12)
		{
			scanf("%d%d", &m, &n);
			nowMoney += m - n;
			if( nowMoney >= l && i + 1 < completeMonth )
			{
				completeMonth = i + 1;
			}
		}
		if( completeMonth == 13 )
		{
			cout << "NA" << endl;
		}
		else
		{
			cout << completeMonth << endl;
		}
	}

	return (0);
}