#include<iostream>

using namespace std;

int main()
{
	int n;
	int M,N;
	int i,j;
	int ans;
	
	for(;cin >> n;)
	{
		if(n==0)
			break;
			
		ans=0;
		
		for(i=0;i<12;i++)
		{
			cin >> M >> N ;
			n-=M-N;
			if(ans==0 && n<=0)
				ans=i+1;
		}
		
		if(ans!=0)
			cout << ans <<endl;
		else
			cout << "NA" << endl;
	}
}