#include<iostream>

using namespace std;

int main(){

  int l;
  while(1){
    cin >> l;
    if(l == 0) break;

    int hantei = 0;
    int frag = 0;

    for(int i = 1; i <= 12; i++){
      int m, n;
      cin >> m >> n;
      l -= (m-n);
      if(frag == 0){
	if(l <=0){
	  hantei = i;
	  frag = 1;
	}
      }
    }

    if(hantei == 0) cout << "NA" <<endl;
    else cout << hantei << endl;
  }

  return 0;
}