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