# encoding: utf-8
N = gets.chomp.to_i
trans = []
5.times do
  x = gets.chomp.to_i
  trans << x
end
# p N
# p trans
pass = [N,0,0,0,0,0]
# p pass
i = 0
while true do
# for i in 1..N do
  if pass[5] >= N then
    break
  end
  (0..4).reverse_each do |j|
    if pass[j] > 0 then
      t = (pass[j] < trans[j]) ? pass[j] : trans[j]
      pass[j+1], pass[j] = (pass[j+1] + t), (pass[j] - t)
    end
  end
  # p i
  # p pass
  i = i + 1
end
puts i