#include<iostream>
using namespace std;
int main(){
  int i,hess,bell=0;
  long long int m,n,money=0;
  while(1){
    cin >> money;
    if(money==0){
      break;
    }
    for(i=1;i<=12;i++){
      cin >> m >> n;
      money-=m-n;
      if(money<=0 && bell==0){
	bell++;
	hess=i;
      }
    }
    if(bell!=0){
      cout << hess << endl;
      bell=0;
    }
    else{
      cout << "NA" << endl;
    }
  }
  return (0);
}