#include<iostream>
#define N 12

int main () {

  int L;
  int sum;
  int mon;
  bool skip;

  while ( true ) {
    cin >> L;
    if ( L == 0 )
      break;
    //sum = L;
    skip = false;
    for ( int i=0; i<N; i++ ) {
      cin >> m >> n;
      L -= m-n;
      if ( L <= 0 && !skip )
	mon = i+1;
      
    }

    if ( skip )
      cout << mon;
    else
      cout << "NA\n";
   }

}


    

    