#include <iostream>
using namespace std;

int main(void){
  int l,m,n;
  
  for(;;){
    
    int flg = 0,cnt = 0;    
    
  con:
    
    cin >> l;
    if( l == 0 ) break;
    
    for( int i = 0 ; i < 12 ; i++ ){
      cin >> m >> n;
      l = l - ( m - n );
      if( flg == 0 ){
	cnt++;
	if( l <= 0 ) flg = 1;
	
	if( cnt == 12 ){
	  cout << "NA" << endl;
	goto con;
	}
      }
      
    }
    
    cout << cnt << endl;
    
  }
  
  return 0;
}