n = gets.to_i
c = Array.new(5) { gets.to_i }

m = Array.new(5, 0)
m[0] = c[0]
1.step(4) do |i|
  m[i] = [m[i - 1], c[i]].min
end

res = 0
t = [0, 1, 2, 3, 4]

cnt = []

5.times do |i|
  cnt << t[i] + n / m[i]
end

puts cnt[4] + 1