#include<iostream>
using namespace std;

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

  while(cin >> L){
    if(L==0) break;
    int  money=0;
    bool flag = false;

    for(int i=0; i<12; i++){
      cin >> M >> N;
      money += M - N;

      if(L <= money && flag == false){
	cout << i+1 << endl;
	flag = true;
	continue;
      }
    }
    if(flag == false) cout << "NA" << endl;

  }
  return 0;
}