n,k,x,y=(int(eval(input())) for i in [0]*4)

print((n*x-(x-y)*max(n-k,0)))
n,k,x,y=[int(eval(input())) for i in range(4)]

print((n*x-(x-y)*max(n-k,0)))
n, k, x, y = (int(eval(input())) for i in [0] * 4)
print((n * x - (x - y) * max(n - k, 0)))

n, k, x, y = [int(eval(input())) for i in range(4)]
print((n * x - (x - y) * max(n - k, 0)))

-n, k, x, y = (int(eval(input())) for i in [0] * 4) +n, k, x, y = [int(eval(input())) for i in range(4)]