#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i,j;
  int l,m,n;
  while(cin>>l&&l){
    for(i=0;i<12;i++){
      cin>>m>>n;
      l-=m-n;
      if(l<=0)
	break;
    }
    for(j=i+1;j<12;j++)
      cin>>m>>n;
    if(i==12)
      cout<<"NA"<<endl;
    else
      cout<<i+1<<endl;
  }
  return 0;
}
      