days_to_stay = int(eval(input()))

special_days = int(eval(input()))

normal_price = int(eval(input()))

special_price = int(eval(input()))

payment = 0 



if days_to_stay <= special_days:

    payment = days_to_stay * normal_price

else:

    payment = (days_to_stay - special_days) * special_price + special_days * normal_price

    

print(payment)
n = int(eval(input()))

k = int(eval(input()))

x = int(eval(input()))

y = int(eval(input()))

print((min(n,k)*x + max(0,n-k)*y))
days_to_stay = int(eval(input()))
special_days = int(eval(input()))
normal_price = int(eval(input()))
special_price = int(eval(input()))
payment = 0
if days_to_stay <= special_days:
    payment = days_to_stay * normal_price
else:
    payment = (
        days_to_stay - special_days
    ) * special_price + special_days * normal_price
print(payment)

n = int(eval(input()))
k = int(eval(input()))
x = int(eval(input()))
y = int(eval(input()))
print((min(n, k) * x + max(0, n - k) * y))

-days_to_stay = int(eval(input())) -special_days = int(eval(input())) -normal_price = int(eval(input())) -special_price = int(eval(input())) -payment = 0 -if days_to_stay <= special_days: -    payment = days_to_stay * normal_price -else: -    payment = ( -        days_to_stay - special_days -    ) * special_price + special_days * normal_price -print(payment) +n = int(eval(input())) +k = int(eval(input())) +x = int(eval(input())) +y = int(eval(input())) +print((min(n, k) * x + max(0, n - k) * y))