import java.io.*; import java.util.*; import java.math.*; class Main236 { public static void out (Object out) { System.out.println(out); } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] line = br.readLine().split(" "); int a = Integer.parseInt(line[0]); int b = Integer.parseInt(line[1]); int x = Integer.parseInt(line[2]); int y = Integer.parseInt(line[3]); if (a < b) { out(y + ((double)y / b) * a); } else if (y < x) { out(x + ((double)x / a) * b); } else { out(Math.min(x , y) * 2); } } }