a,b,x,y = gets.chomp.split(" ").map(&:to_f) if x / a > y / b puts y * (a + b) / b else puts x * (a + b) / a end