#include<bits/stdc++.h>
using namespace std;
int main(){
  int L;
  while(cin>>L,L!=0){
    int chokin=0,month=0;
    for(int i=1;i<=12;i++){
      int syuueki,syouhi;
      cin>>syuueki>>syouhi;
      chokin+=(syuueki-syouhi);
      if(month!=0)
	continue;
      if(chokin>=L)
	month=i;
    }
    if(month==0)
      cout<<"NA"<<endl;
    else
      cout<<month<<endl;
  }
  return 0;
}