#include <iostream>

using namespace std;

typedef long long ll;

main(){
  while(1){
    ll L;
    cin >> L;
    if(L==0) break;
    bool first=true;
    ll sum=0;
    for(int i=0;i<12;i++){
      ll M, N;
      cin >> M >> N;
      sum+=M-N;
      if(first && sum>=L){
	first=false;
	cout << i+1 << endl;
      }
    }
    if(first) cout << "NA" << endl;
  }
  return 0;
}