import java.util.Scanner; public class Sample2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double rateCoffee = sc.nextDouble(); double rateTea = sc.nextDouble(); double coffee = sc.nextDouble(); double tea = sc.nextDouble(); System.out.println((rateCoffee + rateTea) * Math.min(coffee/rateCoffee, tea/rateTea)); } }