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