#include <iostream>
using namespace std;
int main(){
  int l,m,n;
  while(  cin >> l,l ){
    int s = 0;
    int ans;
    int f = 1;
    for(int i = 1 ; i <= 12 ; i++ ){
      cin >> m >> n;
      s += (m - n);
      if(s > l && f == 1){ans = i;f = 0;}
    }
    if(f == 1)cout << "NA" << endl;
    else cout << ans << endl;
  }
  return 0;
}