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

int main(void)
{
  int L,m,n,q=0,r=0;
  while(1){
    cin >> L;
    if(L == 0) break;
    else{
      for(int i= 0;i < 12;++i){
        cin >> m >> n;
        q +=m-n;
        ++r;
        if(q >= L) break;
      }
      if(q < L) cout << "NA" << endl;
      else{
        cout << r << endl;
      }
    }
  }
}