N, K, X, Y = (int(eval(input())) for i in range(4))

print((K * X + (N - K) * Y if N > K else N * X))
N = int(eval(input()))

K = int(eval(input()))

X = int(eval(input()))

Y = int(eval(input()))

if N > K:

	print((K * X + (N - K) * Y))

else:

	print((N * X))
N, K, X, Y = (int(eval(input())) for i in range(4))
print((K * X + (N - K) * Y if N > K else N * X))

N = int(eval(input()))
K = int(eval(input()))
X = int(eval(input()))
Y = int(eval(input()))
if N > K:
    print((K * X + (N - K) * Y))
else:
    print((N * X))

-N, K, X, Y = (int(eval(input())) for i in range(4)) -print((K * X + (N - K) * Y if N > K else N * X)) +N = int(eval(input())) +K = int(eval(input())) +X = int(eval(input())) +Y = int(eval(input())) +if N > K: +    print((K * X + (N - K) * Y)) +else: +    print((N * X))