#include<iostream>
using namespace std;
int main(){
  int l,m,n,ans;
  while(cin>>l){
    if(l==0) break;
    ans = 0;
    for(int i=1;i<=12;i++){
      cin >> m >> n;
      ans += m - n;
      if(ans>=l){
	cout << i << endl;
	for(int j=i+1;j<=12;j++) cin >> m >> n;
	break;
      } 
      else if(i==12) cout << "NA" << endl;
    }
  }
  return 0;
}