ss = input().split() a = int(ss[0]) b = int(ss[1]) x = int(ss[2]) y = int(ss[3]) f = x / a if y / b < f: f = y / b ans = (a + b) * f print(ans)