// 0206
#include <iostream>
using namespace std;

int main(){
	while(1){
		int L, M, N, ans = 0;
		
		cin>>L;
		if(L == 0)
			break;

		for(int i=1;i<=12;i++){
			cin>>M>>N;
			L -= M-N;

			if((L <= 0) && (ans == 0))
				ans = i;
		}

		if(ans == 0)
			cout<<"NA"<<endl;
		else
			cout<<ans<<endl;
	}

	return 0;
}