#include <iostream>
using namespace std;

int main()
{
  int l;

  while (cin >> l && l != 0){
    int m, n, a = 0;
    for (int i = 1; i <= 12; i++){
      cin >> m >> n;
      l = l - m + n;
      if (l > 0){
        a = i;
      }
    }
    if (a == 12){
      cout << "NA" << endl; 
      continue;
    }
    cout << a + 1 << endl;
  }
}