#include <iostream>
#include <string>

using namespace std;

int main() {
  int l, m, n;
  ios::sync_with_stdio(false);
  
    
  while (1) {
    cin >> l;
    //cout << "aa" << l << endl;
    if(l!=0){
      int i;
      int month=0;
      for(i=1;i<=12;i++){
	cin >> m >> n;
	//cout << i << m << n << endl;
	
	l = l - (m-n);
	if(l<=0 && month==0)
	  {month = i;}
      }

      //cout << "bb" << l << endl;

      if(month==0)
	cout << "NA" <<endl;
      else
	cout << month << endl;
    }
    else
      break;
  }
    
    return 0;
}