#include<iostream>
using namespace std;

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