#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

int main()
{
	int l, m, n;
	while (scanf("%d", &l), l)
	{
		int ans = 0;
		for (int i = 0; i < 12; ++i)
		{
			int t;
			scanf("%d %d", &m, &n);
			l -= m - n;
			if (l <= 0 && !ans)
				ans = i+1;
		}
		if (ans)
			printf("%d\n", ans);
		else
			puts("NA");
	}

	return 0;
}