#include <iostream>
using namespace std;

int main(){
  int L;

  while(cin >> L, L){
    int N, M;
    int sum = 0, ans = -1;

    for(int y = 1; y <= 12; y++){
      cin >> N >> M;
      sum += N - M;

      if(ans != -1){
        continue;
      }
      if(sum >= L){
        ans = y;
      }
    }

    if(ans == -1){
      cout << "NA\n";
    }
    else{
      cout << ans << endl;
    }
  }
}