#include<iostream>
using namespace std;

int main(){
  int M, N, L;
  int c = 0;
  while(1){
    cin >> L;
    if(L == 0) break;
    for (int i = 0; i < 12; i++){
      cin >> M >> N;
      if(L <= 0) continue;
      L -= M - N;
      c++;
    }
    if(L > 0) cout << "NA" << endl;
    else cout << c << endl;
    c = 0;
  }
  return 0;
}