a = [int(eval(input())) for i in range(4)]

if a[0] <= a[1]:

  print((a[0]*a[2]))

else:

  print((a[1]*a[2] + (a[0]-a[1])*a[3]))
a = int(eval(input()))

b = int(eval(input()))

c = int(eval(input()))

d = int(eval(input()))



if a > b:

  print((b*c+(a-b)*d))

else:

  print((a*c))
a = [int(eval(input())) for i in range(4)]
if a[0] <= a[1]:
    print((a[0] * a[2]))
else:
    print((a[1] * a[2] + (a[0] - a[1]) * a[3]))

a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
if a > b:
    print((b * c + (a - b) * d))
else:
    print((a * c))

-a = [int(eval(input())) for i in range(4)] -if a[0] <= a[1]: -    print((a[0] * a[2])) +a = int(eval(input())) +b = int(eval(input())) +c = int(eval(input())) +d = int(eval(input())) +if a > b: +    print((b * c + (a - b) * d)) -    print((a[1] * a[2] + (a[0] - a[1]) * a[3])) +    print((a * c))