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