#include<iostream>
using namespace std;
int main(){
  bool flag;
  int M, N, L, ans, mon;
  while(1){
    ans = flag = 0;
    cin >> L;
    if(L == 0) break;
    for(int i = 1; i <= 12; i++){
      cin >> M >> N;
      ans += (M - N);
      if(L <= ans && flag == 0){
	flag = 1;
	mon = i;
      }
    }
    if(flag == 0) cout << "NA" << endl;
    else cout << mon << endl;
  }
}