a, b, x, y = map(int,input().split()) if a/b >= x/y : amount = x * (1 + b/a) else : amount = y * (1 + a/b) print(amount)