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