#include <iostream>
using namespace std;
int main()
{
  for(;;){
    int L;
    cin >> L;
    if(L == 0) break;
    int count = 1;
    for(int i=0; i<12; i++){
      int in,out;
      cin >> in >> out;
      L -= in - out;
      if(L > 0) count++;
    }
    if(L > 0) cout << "NA" << endl;
    else cout << count << endl;
  }
  return 0;
}