#include<iostream>
using namespace std;

int main(){
  int L,M,N;

  while(cin >> L){
    if(L==0) break;
    int count=0, money=0;
    bool flag = false;
    while(1){
      cin >> M >> N;
      count++;
      if(count > 12){
	if(flag == false) cout << "NA" << endl;
	break;
      }
      if(flag == true) continue;
      money += M - N;
      if(L <= money){
	cout << count << endl;
	flag = true;
	continue;
      }
    }    
  }
  return 0;
}