A, B, X, Y = map(int, input().split()) print((A+B) * min(X/A, Y/B))