#include <iostream>
using namespace std;

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

int l;

void solve() {
  int tl = 0; bool flag = false;
  rep(i,12) {
    int m, n; cin>>m>>n;
    if (flag) continue;
    tl += (m-n);
    if (tl >= l) {
      cout<<i+1<<endl;
      flag = true;
    }
  }
  if (flag) return;
  cout<<"NA"<<endl;
}

int main (int argc, char const* argv[]) {
  while (cin>>l, l) {
    solve();
  }
  return 0;
}