#include<iostream>
#include<vector>
#include<cstdio>
#include<cstring>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)

int main() {
  for (;;) {
      int L; cin >> L; if (L == 0) break;
      int ans = -1;
      int have = 0;
      REP(step, 12) {
          int a, b; cin >> a >> b;

          have += a;
          have -= b;
          if (have >= L && ans == -1) {
              ans = step + 1;
          }
      }
      if (ans == -1) cout << "NA" << endl;
      else cout << ans << endl;
  }
  return 0;
}