import std.stdio, std.conv, std.string, std.range, std.math, std.algorithm; void main() { auto input = readln.split.to!(real[]); auto A = input[0], B = input[1], X = input[2], Y = input[3]; auto rate = min(A, B) / max(A, B); auto few = min(max(X, Y) * rate, min(X, Y)); auto many = few * max(A, B) / min(A, B); "%.15s".writefln(few + many); }