#include <iostream>
using namespace std;


int main(){

  int l;
  while(1){
    cin >> l;
    if(l == 0)break;
    int sum=0;
    bool f = true;
    for(int i=0;i<12;i++){
      int m,n;
      cin >> m >> n;
      sum += (m-n);
      if(l <= sum && f){
	cout << i+1 << "\n";
	f = false;
      }
    }
    if(l>sum)
      cout << "NA\n";
  }
}