import math a, b, x, y = map(int, input().split()) c = x / a d = y / b if c > d: z = d * a print(z + y) else: z = c * b print(z + x)