a, b, x, y = gets.split.map(&:to_f) m = [x / a, y / b].min puts a * m + b * m