A, B, X, Y = [int(i) for i in input().strip().split(' ')] print((A + B) * min(X / A, Y / B))