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

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

-print((min(n, k) * x + max(n - k, 0) * y)) +print((n * x - (x - y) * max(n - k, 0)))