a, b, x, y = map(int, input().split()) print(min(x + b / a * x, y + a / b * y))