#include<iostream>
using namespace std;

int main(){
  int n,m,l;
  while(true){
    cin >> l;
    if(l==0)break;

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