#include <iostream>

using namespace std;

int main() {
  for (;;) {
    int L, M[12], N[12];
    cin >> L;
    if (!L) return 0;
    int r = 0;
    for (int i = 0; i < 12; i++)
      cin >> M[i] >> N[i];
    for (int i = 0; i < 12; i++) {
      r += M[i] - N[i];
      if (r >= L) {
        cout << i + 1 << endl;
        break;
      }
    }
    if (r < L)
      cout << "NA" << endl;
  }
}