def five_transportations(n, a, b, c, d, e)
  ans = 0
  params = [a, b, c, d, e]
  cities = Array.new(6, 0)
  cities[0] = n
  until n == cities[5]
    ans += 1
    5.downto(1) do |i|
      if cities[i - 1] > 0
        diff = [cities[i - 1], params[i - 1]].min
        cities[i] += diff
        cities[i - 1] -= diff
      end
    end
  end

  ans
end

n = gets.to_i
a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
puts five_transportations(n, a, b, c, d, e)