while (l = gets.to_i) != 0
  sum = 0
  flag = true
  1.upto(12) do |i|
    m,n = gets.split(" ").map(&:to_i)
    sum += m - n
    if sum >= l && flag
      puts i
      flag = false
    end
  end
  puts "NA" unless flag
end