#include <iostream>
#include <cstdlib>
#include <string>

using namespace std;

int main() {
  while( 1 ) {
    int l;
    cin >> l;
    if( !l ) { return EXIT_SUCCESS; }
    
    int mth = -1;
    for( int i = 1; i <= 12; i++ ) {
      int m, n;
      cin >> m >> n;
      l -= ( m - n );
      if( mth == -1 && l <= 0 ) { mth = i; }
    }
    cout << ( mth == -1 ? "NA" : to_string( mth ) ) << endl;
  }
}