#include <iostream>
using namespace std;

bool solve() {
  int L;
  cin >> L;
  if (!L) {
    return false;
  }
  int s = 0;
  int ans = -1;
  for (int i = 1; i <= 12; ++i) {
    int m, n;
    cin >> m >> n;
    if (ans != -1) {
      continue;
    }
    s += m - n;
    if (s >= L) {
      ans = i;
    }
  }
  if (ans > 0) {
    cout << ans << endl;
  } else {
    cout << "NA" << endl;
  }
  return true;
}

int main() {
  while (solve()) {}
  return 0;
}