#include <iostream>

using namespace std;

int main () {
    int L;
    while (cin >> L, L) {
          int sum = 0, mon = 0;
          for (int i = 1; i <= 12; ++i) {
              int M, N;
              cin >> M >> N;
              if (!mon && (sum += M - N) >= L) mon = i;
          }
          if (mon) cout << mon << endl;
          else cout << "NA" << endl;
    }
}