#include <iostream>
using namespace std;

int main(){
  int l, m, n;

  while(cin >> l, l){
    int ans = -1;

    for(int i = 0; i < 12; i++){
      int m, n;
      cin >> m >> n;

      if(ans != -1) continue;

      l -= m - n;

      if(l <= 0){
        ans = i + 1;
      }
    }

    if(ans == -1){
      cout << "NA\n";
    }
    else{
      cout << ans << endl;
    }
  }
}