#include <iostream>
using namespace std;

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

  }
 
  return 0;
}