#include<bits/stdc++.h>
using namespace std;

int main(int argc, char *argv[]){
  int l, m, n;
  while(std::cin >> l, l){
    int sum = 0, ans = 1e9;
    for (int i = 0; i < 12; i++) {
      std::cin >> m >> n;
      sum += m - n;
      if(sum >= l && ans == 1e9)ans = i + 1;
    }
    if(ans == 1e9) std::cout << "NA" << std::endl;
    else std::cout << ans << std::endl;
  }
  return 0;
}