import java.util.Scanner object Problem236 { def main(args: Array[String]) { val sc = new Scanner(System.in) val (a, b, x, y) = (sc.nextDouble, sc.nextDouble, sc.nextDouble, sc.nextDouble) val result = x * b / a < y match { case true => x + x * b / a case false => y + y * a / b } println(result) } }