nums = gets.split.map(&:to_i)
set = {nums[1] => nums[2], nums[3] => nums[4]}
totals = []
i = 0
set.each do |num, value|
  sets = nums[0] % num == 0 ? nums[0]/num : nums[0]/num + 1
  totals[i] = sets * value
  i += 1
end
puts totals.min
