#include <iostream>
using namespace std;

int main(void){
	int l;
	while(cin>>l,l){
		int ans = -1;
		for(int i=0;i<12;i++){
			int n,m;
			cin>>m>>n;
			l -= m - n;
			if(ans == -1 && l <= 0) ans = i + 1;
		}

		if(ans == -1) cout<<"NA\n";
		else cout<<ans<<endl;
	}

	return 0;
}