#include <iostream>

using namespace std;

int main(){
  int n;
  while(true){
    cin >> n;
    if(n==0)
      break;
    int tsk = 0, ss=0;
    bool dd = true;
    for(int i=0; i<12; i++){
      int a, b;
      cin >> a >> b;
      tsk += (a-b);
      if(tsk >= n && dd){
	ss = i+1; dd = false;
      }
    }
    if(ss == 0)
      cout << "NA\n";
    else
      cout << ss << endl;
  }

  return 0;
}