Problem:
 Score : 100 points    Problem Statement There is a hotel with the following accommodation fee:   X yen (the currency of Japan) per night, for the first K nights  Y yen per night, for the (K+1) -th and subsequent nights   Tak is staying at this hotel for N consecutive nights.
Find his total accommodation fee.      Constraints  1 \leq N, K \leq 10000  1 \leq Y < X \leq 10000  N,\,K,\,X,\,Y are integers.         Input The input is given from Standard Input in the following format:  N  K  X  Y       Output Print Tak's total accommodation fee.        Sample Input 1 5
3
10000
9000      Sample Output 1 48000  The accommodation fee is as follows:   10000 yen for the 1 -st night  10000 yen for the 2 -nd night  10000 yen for the 3 -rd night  9000 yen for the 4 -th night  9000 yen for the 5 -th night   Thus, the total is 48000 yen.       Sample Input 2 2
3
10000
9000      Sample Output 2 20000

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N > K:
    t = X * K + Y*(N-K)
    print(t)
else:
    t = X*N
    print(t)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

total = 0
for i in range(N):
  if i < K:
    total += X
  else:
    total += Y
print(total)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n<=k:
    ans = x*n
else:
    ans = x*k + y*(n-k)

print(ans)

Solution (Python):
n,k,x,y = [int(input()) for i in range(4)]
print(n*x if n<=k else k*x + (n-k)*y)

Solution (Python):
def main():
    n,k,x,y = (int(input()) for _ in range(4))
    if n <= k:
        print(n*x)
    else:
        print(k*x + (n-k)*y)

if __name__ == '__main__':
    main()

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

Solution (Python):
N, K, X, Y = [int(input()) for _ in range(4)]

print(N*X - (X -Y) * max(N-K, 0))

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

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
total = 0

for i in range(1,N+1):
    if i <= K:
        total += X
    else:
        total += Y

print(total)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y =int(input())
print(X*min(N,K)+Y*max(0,N-K))

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

sum = 0
for i in range(1,N+1):
    if i <= K:
        sum += X
    else:
        sum += Y
print(sum)

Solution (Python):

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

use_num = inputs[0]
sell_start_num = inputs[1]
basic_price = inputs[2]
sell_price = inputs[3]
price_sum = 0

for i in range(use_num):
    if i >= sell_start_num:
        price_sum += sell_price
    else:
        price_sum += basic_price

print(price_sum)

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())

if n <= k:
  print(x * n)
else:
  print(k * x + (n - k) * y)

Solution (Python):


n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n <= k:
    print(n*x)
else:
    print(k*x + (n-k)*y)

Solution (Python):

def ABC_44_A():
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())

    syukuhakuhi = 0

    for i in range(N+1):

        if i!=0:
            if i <= K:
                syukuhakuhi+=X
            else:
                syukuhakuhi+=Y
    print(syukuhakuhi)


if __name__ == '__main__':

    ABC_44_A()

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
sm = 0
if n<=k:
    sm+=x*n
else:
    sm+=x*k + (n-k)*y
print(sm)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
fee = 0
for i in range(1, n+1):
    if i <= k:
        fee += x
    else:
        fee += y
print(fee)

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

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
print(k*x + y*(n-k) if n > k else x*n)

Solution (Python):
s = [int(input()) for i in range(4)]

if s[0] < s[1]:
    print(s[0] * s[2])
else:
    print(s[1] * s[2] + (s[0] - s[1]) * s[3])

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n <= k:
  print(x * n)
else:
  print(x*k + y*(n-k))

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n < k:
    ans = n * x
    print(ans)

else:
    ans = x * k + y * (n - k)
    print(ans)

Solution (Python):
n,k,x,y=[int(input()) for i in range(4)]
print(min(k,n)*x+max(0,n-k)*y)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())


if N<=K:
    print(X*N)

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

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
print(min(K, N) * X + max(N-K, 0) * Y)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

o = n - k

sum = 0
if o > 0:
    sum += k * x
    sum += o * y
    print(sum)
    exit()
else:
    sum += n * x
    print(sum)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

o = n - k

sum = 0
if o > 0:
    sum += k * x
    sum += o * y
else:
    sum += n * x

print(sum)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N<=K:
  Sum = X*N 
elif N>K:
  Sum = X*K + Y*(N-K)
  
print(Sum)

Solution (Python):
n,k,x,y = [int(input()) for i in range(4)]
if n <= k:
    money = n*x
else:
    money = k*x + (n-k)*y
print(money)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

ans = 0
if N > K:
    ans = (X * K) + (Y * (N - K))
else:
    ans = X * N

print(ans)

Solution (Python):
N,K,X,Y=map(int,open(0));print(N*X if N<=K else K*X+(N-K)*Y)

Solution (Python):
N,K,X,Y=map(int, open(0).read().split());print(N*X if N<=K else K*X+(N-K)*Y)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N <= K:
    print(N*X)
else:
    print(K*X + (N-K)*Y)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n <= k:
    print(int(x*n))
else:
    print(int(x*k+y*(n-k)))

Solution (Python):

def resolve():
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())
    xdays = min(N, K)
    ydays = max(N-K, 0)
    print(X*xdays+Y*ydays)
    
    


if '__main__' == __name__:
    resolve()

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n>k:
    ans=x*k+(n-k)*y
else:
    ans=x*n
print(ans)

Solution (Python):
n, k, x, y = [int(input()) for _ in range(4)]
print(x * k + y * (n - k) if n > k else x * n)

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

Solution (Python):
n,k,x,y=[int(input()) for _ in range(4)]
print(k*x+(n-k)*y if n>k else n*x)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

ans = 0

if n>=k:
    ans = k*x+(n-k)*y
else:
    ans = n*x

print(ans)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if k < n:
  print(k*x+(n-k)*y)
else:
  print(n*x)

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())

sum=0

if n>=k:
    sum=k*x
    sum=sum+(n-k)*y

if n<k:
    sum=n*x

print(sum)

Solution (Python):
n,k,x,y=[int(input())for i in range(4)]
a=b=0
a=k*x if n>k else n*x;b=(n-k)*y if n>k else 0
print(a+b)

Solution (Python):
n=int(input())
k=max([0,n-int(input())])
print(int(input())*(n-k)+int(input())*k)

Solution (Python):
n=int(input())
k=max([0,n-int(input())])
x=int(input())
y=int(input())
print(x*(n-k)+y*k)

Solution (Python):
N=int(input())
K=int(input())
X=int(input())
Y=int(input())

if N <= K:
  ans=N*X
else:
  ans=K*X+(N-K)*Y
print(ans)

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

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

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n <= k:
  print(n*x)
else:
  print(k*x+(n-k)*y)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

fee = 0
if (n <= k):
    fee = n*x
else:
    fee = k*x + (n-k)*y
    
print(fee)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7


n=I()
k=I()
x=I()
y=I()
if n<=k:
    ans=n*x
else:
    ans=k*x+(n-k)*y
print(ans)

Solution (Python):
n = [int(input()) for _ in range(4)]
if n[0]<=n[1]:
    print(n[0]*n[2])
else:
    print((n[1]*n[2])+(n[0]-n[1])*n[3])

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())


if N > K :
    SUM = (K*X) + ((N-K)*Y)
else:
    SUM = N*X


print(SUM)

Solution (Python):
n= int(input())
k= int(input())
x= int(input())
y= int(input())
soma=0
if k > n:
	soma=n*x
else:
	soma= (x*k)+(y*(n-k))
print(soma)

Solution (Python):
n, k, x, y = map(int, open(0).read().split())
print(min(n,k)*x + max(0, (n-k))*y)

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
print(k*x+(n-k)*y if n>=k else n*x)

Solution (Python):
N=int(input())
K=int(input())
X=int(input())
Y=int(input())

P=N-K

if P>0:
    print(P*Y+K*X)
else:
    print(N*X)

Solution (Python):
n,k,x,y=(int(input()) for i in range(4))
if n<=k:
    ans=n*x
else:
    ans=k*x+(n-k)*y
print(ans)

Solution (Python):
stay = int(input())
change_day = int(input())
first_cost = int(input())
change_cost = int(input())
total_cost = 0
 
for i in range(stay):
 if(i < change_day):
  total_cost += first_cost
 else:
  total_cost += change_cost
print(total_cost)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if K < N:
    print(K * X + (N - K) * Y)
else:
    print(N * X)

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

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n<=k:
  print(n*x)
else:
  print(k*x+(n-k)*y)

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

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

Solution (Python):
N, K, X, Y = [int(input()) for _ in range(4)]
print(min(N,K)*X + max(N-K, 0)*Y)

Solution (Python):
A = []
for i in range(4):
    A.append(int(input()))
if A[0] > A[1]:
    print(A[2] * A[1] + A[3] * (A[0]-A[1]))
else:
    print(A[2] * A[0])

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())

    if N <= K:
        ans = N * X
    else:
        ans = K * X + (N - K) * Y

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n>k:
    print(k*x+(n-k)*y)
else:
    print(n*x)

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())

if k>=n:
    print(n*x)
else:
    print(k*x+(n-k)*y)

Solution (Python):
n,k,x,y=[int(input()) for i in range(4)]
if n>k:
	print(x*k+y*(n-k))
else:
	print(x*n)

Solution (Python):
N,K,X,Y = [int(input()) for i in range(4)]
print(N*X if N<=K else (N-K)*Y+K*X)

Solution (Python):
n=int(input())
a=int(input())
b=int(input())
c=int(input())

if n <= a:
  print(n*b)
else:
  print(a*b+(n-a)*c)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n>k:
  print(k*x+(n-k)*y)
else:
  print(n*x)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n <= k:
  print(n*x)
else:
  print(k*x+(n-k)*y)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

print(X * min(K, N) + Y * max(0, N - K))

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n <= k:
	price = x*n

else:
	price = x*k + y*(n-k)

print(price)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())

if a > b:
  print(b*c+(a-b)*d)
else:
  print(a*c)

Solution (Python):
n = input()
k = input()
x = input()
y = input()

n = int(n)
k = int(k)
x = int(x)
y = int(y)

if(n<k):
  print(n*x)
else:
  print((k)*x + y*(n-k))

Solution (Python):
n,k,x,y = (int(input()) for i in[0]*4)
ans = 0
if n > k:
    ans = x*k + (n-k)*y
else:
    ans = n*x
print(ans)

Solution (Python):
a,b,c,d=[int(input()) for i in range(4)]
if a<=b:
  print(a*c)
else:
  print(b*c+(a-b)*d)

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n<=k:
  print(n*x)
else:
  print(k*x+(y*(n-k)))

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
s1=k*x
d1=n-k
s2=d1*y

if( k>=n):
    s=x*n
    print(s)
else:
    print(s1+s2)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
ans = X * min(N, K) + Y * max(N - K, 0)
print(ans)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N > K:
    print(X * K + Y*(N-K))
else:
    print(X * N)

Solution (Python):
N, K, X, Y = [int(input()) for _ in range(4)]
print(K * X + (N - K) * Y if N >= K else N * X)

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n>k:
  print(k*x+(n-k)*y)
else:
  print(n*x)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y= int(input())
plus = (n-k) * y if n > k else 0
print(min(n, k) * x + plus)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N <= K:
    print(N*X)
    
else:
    print(K*X + (N-K) * Y)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n <= k:
    print(n*x)

else:
    print(k*x + (n-k)*y)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N - K > 0:
    print(K*X + (N-K)*Y)
else:
    print(N*X)

Solution (Python):
N=int(input())
K=int(input())
X=int(input())
Y=int(input())
if N<K:
    print(N*X)
else:
    print(K*X+(N-K)*Y)

Solution (Python):
def resolve():
    n=int(input())
    k=int(input())
    x=int(input())
    y=int(input())
    if n<k:
        print(n*x)
    else:
        print(k*x+(n-k)*y)
resolve()

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    

    
    

    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())
    res = 0
    cnt = 1
    while cnt<=n:
        if cnt <= k:
            res += x
        else:
            res += y
        cnt += 1
    print(res)

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
print(X * min(K,N) + max(N-K,0) * Y )

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n <= k:
    print(n * x)
else:
    print((k * x) + (n-k)*y)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N >= K:
    res = K*X + (N-K)*Y

else:
    res = N*X

print(res)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

AC=0

for i in range(1,N+1):
    if i <= K:
        AC += X
    else:
        AC += Y

print(AC)

Solution (Python):
N=int(input())
K=int(input())
X=int(input())
Y=int(input())

P=N-K


if N-K>=0:
  print(K*X+(N-K)*Y)
else:
  print(N*X)

Solution (Python):
arr = []
for _ in range(4):
  arr.append(int(input()))

if arr[1] > arr[0]:
  arr[1] = arr[0]
charge = arr[1]*arr[2] + (arr[0]-arr[1])*arr[3]
print(charge)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
ans = 0
if n > k:
    print((n - k) * y + k * x)
else:
    print(n * x)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
ans = 0
for i in range(1,n+1):
    if i <= k:
        ans += x
    else:
        ans += y
print(ans)

Solution (Python):
N=int(input())
K=int(input())
X=int(input())
Y=int(input())
a=0
for i in range(N):
    if i<K:
        a+=X
    else:
        a+=Y
print(a)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())


if k >= n:
    print(x*n)
else:
    print(x*k + y*(n-k))

Solution (Python):
N=int(input())
K=int(input())
X=int(input())
Y=int(input())

ex=N-K
if ex<0:
  charge=N*X
else:
  charge=K*X+ex*Y

print(charge)

Solution (Python):
day = int(input())
posreday= int(input())
price = int(input())
posreprice = int(input())
if day<= posreday:
  print(day * price)
elif day > posreday:
  print(posreday * price + (day - posreday) * posreprice)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())

if (a-b)<0:
  print(c*a)
else:
  print(c*b +d*(a-b))

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n<=k:
  print(n*x)
else:
  print(k*x+(n-k)*y)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

print(sum([X if K >= i else Y for i in range(1, N+1)]))

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n<=k:
    price = x*n
else:
    price = x * k + (y * (n - k))

print(price)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
if a <= b:
    print(a*c)
else:
    print(b*c+(a-b)*d)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n <= k:
    price = x * n
else:
    price = x * k + (y * (n - k))

print(price)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n > k:
  print(k * x + (n - k) * y)
else:
  print(n * x)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
k = 1 
result = 0
if K < N:
    while k <= K:

        result += X
        k += 1
    while k <= N:

        result += Y
        k += 1
if K >= N:
    while k <= N:
        result += X
        k += 1
print(result)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n > k:
    print(k * x + (n - k) * y)
else:
    print(n * x)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
ans=0
if a<=b:
    ans=a*c
else:
    ans=b*c+(a-b)*d
print(ans)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n - k > 0:
    print(x * k + y * (n - k))
else:
    print(x * n)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n <= k:
    print(n * x)
else:
    print(k * x + (n - k) * y)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if k >= n:
  print(n*x)
else:
  print(k*x+(n-k)*y)

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())

if n > k:
    print(k*x + (n-k)*y)
else:
    print(n*x)

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())

if n>k:
    print(k*x+(n-k)*y)
else:
    print(n*x)

Solution (Python):
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, k, x, y = nin(4)

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

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

fee = 0

for i in range(N):
    if i < K:
        fee += X
    else:
        fee += Y

print(fee)

Solution (Python):
N=int(input())
K=int(input())
X=int(input())
Y=int(input())


if N-K>=0:
    print(K*X+(N-K)*Y)
else:
    print(X*N)

Solution (Python):
def resolve():
	ins = []
	for _ in range(4):
		ins.append(int(input()))
	n, k, x, y = ins
	if n - k and n > k:
		print(x*k + y*(n-k))
	else:
		print(x*n)
        
resolve()

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
f=0
if(n<=k):
  f=n*x
else:
   f=k*x+(n-k)*y
print(f)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n > k:
    print(k * x + (n-k)*y)
else:
    print(n*x)

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

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

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N <= K:
    print(N*X)
else:
    l = K*X
    m = (N-K)*Y
    ans = l + m
    print(ans)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if K < N:
    x = X*K + Y*(N-K)
    print(x)
else:
    x = N*X
    print(x)

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n<=k:
  print (n*x)
else:
  print (x*k+y*(n-k))

Solution (Python):
N, K, X, Y = [int(input()) for _ in range(4)]

discounted_dates = N - K
if discounted_dates < 0:
    discounted_dates = 0

print((N * X) - (X - Y) * discounted_dates)

Solution (Python):
icase=44
if icase==44:
    n=int(input())
    k=int(input())
    x=int(input())
    y=int(input())
    if n<=k:
        print(n*x)
    else:
        print(k*x+(n-k)*y)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N > K:
    print(X*K + Y*(N-K))
else:
    print(X*N)

Solution (Python):
def main():
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())

    total_price = 0

    for i in range(1,N+1):
        if i <= K:
            total_price += X
        else:
            total_price += Y
    
    print(total_price)

main()

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

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

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n > k:
    print(x * k + y * (n-k))
else:
    print(x * n)

Solution (Python):

import collections


def solve(n, k, x, y):
    return min(n, k) * x + max(0, n-k) * y


n = int(input().strip())
k = int(input().strip())
x = int(input().strip())
y = int(input().strip())

print(solve(n, k, x, y))

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())

tot=0

for i in range(n):
    i+=1
    if i<=k:
        tot+=x
        
    else:
        tot+=y
print(tot)

Solution (Python):
N=int(input())
K=int(input())
X=int(input())
Y=int(input())
b=0
for a in range(1,N+1):
  if a<=K:
    b+=X
  else:
    b+=Y
print(b)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

ans = 0
for i in range(1,N+1):
    if i <= K:
        ans += X
    else:
        ans += Y
print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
ans=0
if a>=b:
    ans+=b*c
    ans+=(a-b)*d
else:
    ans+=a*c
print (ans)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N <= K:
  print(N*X)

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

Solution (Python):
n, k, x, y = int(input()), int(input()), int(input()), int(input())
if n <= k:
  ans = n * x
else:
  ans = k * x + (n - k) * y
print(ans)

Solution (Python):
n,k,x,y=[int(input())for _ in [0]*4]
print(n*x) if n<k else print(y*(n-k)+x*k)

Solution (Python):
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:input()

"""========main code==============="""

t=ii()
x=ii()
y=ii()
z=ii()
k=min(t,x)
print(k*y+(t-k)*z)

Solution (Python):
n,k,x,y = map(int, open(0))
print(n*x - (x-y)*max(n-k, 0))

Solution (Python):
n=int(input())
k=int(input())
a=int(input())
b=int(input())
print(min(n,k)*a+max(0,n-k)*b)

Solution (Python):
N, K, X, Y = map(int, open(0).read().split())
print(X*min(N, K)+Y*max(N-K, 0))

Solution (Python):

N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N - K > 0:
    ans = K * X + (N - K) * Y
else:
    ans = N * X
print(ans)

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())

    if N <= K:
        ans = X * N
    else:
        ans = X * K + Y * (N - K)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if k>=n:
    print(n*x)
else:
    print((x*k)+(y*(n-k)))

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

kx = min(N, K)
ky = max(N, K) - K
print(X*kx + Y*ky)

Solution (Python):
n,k,x,y = [int(input()) for i in range(4)]
print(x*min(k,n)+y*max(0,n-k))

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

print((min(N,K)*X) + (max(0,(N-K))*Y))

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())


if N > K :
    total = K*X + (N-K)*Y
else :
    total = N * X


print(total)

Solution (Python):
if __name__ == "__main__":
  n = int(input())
  k = int(input())
  x = int(input())
  y = int(input())

  if n <= k:
    print(int(n*x))
  else:
    print(int(k*x+(n-k)*y))

Solution (Python):

import sys
input = sys.stdin.readline
import numpy as np









N = int(input())
K = int(input())
X = int(input())
Y = int(input())

print(min(N,K)*X + max(N-K,0)*Y)

Solution (Python):
nancy=int(input())
kite=int(input())
xmas=int(input())
yanke=int(input())
if nancy>kite:
  print((nancy-kite)*yanke+xmas*kite)
else:
  print(xmas*nancy)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N<=K:
    print(int(N*X))
else: 
    print(int(K*X+(N-K)*Y))

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())


if k>=n:
    print(n*x)
else:
    print(k*x+(n-k)*y)

Solution (Python):
N=int(input())
K=int(input())
X=int(input())
Y=int(input())

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

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())

ans=0

for i in range(1,n+1):
    if i<=k:
        ans+=x
    else:
        ans+=y

print(ans)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n > k:
  print(k*x+(n-k)*y)
else:
  print(n*x)

Solution (Python):
n, k = int(input()), int(input())
x,y = int(input()), int(input())
if n>k: 
    a = n-k
    print((x*k) + (y*a))
else: 
    print(x*n)

Solution (Python):
li = list(int(input()) for i in range(4))

if li[0] > li[1]:
    ans = li[1]*li[2] + (li[0]-li[1])*li[3]
else:
    ans = li[0]*li[2]
print(str(ans))

Solution (Python):
N=int(input())
K=int(input())
X=int(input())
Y=int(input())
if N<=K:
    print(N*X)
else:
    print(K*X+(N-K)*Y)

Solution (Python):
N,K,X,Y = [int(input()) for i in range(4)]
if N>K:
  total = N*X- (N-K)*(X-Y)
  print(total)
else:
  total = N*X
  print(total)

Solution (Python):
x=[]
for i in range(0,4):
  x.append(int(input()))
s=0
for j in range(0,x[0]):
  if j+1<=x[1]:
    s+=x[2]
  else:
    s+=x[3]
    
print(s)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N <= K:
  print(X * N)
else:
  print(X*K+Y*(N-K))

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N <= K:
    print(N * X)
else:
    print(K * X + (N - K) * Y)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n < k:
    print(n*x)
else:
    print(k*x+(n-k)*y)

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

Solution (Python):
n, k, x, y = [int(input()) for _ in range(4)]
if n >= k:
    print(k * x + (n - k) * y)
else:
    print(n * x)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N >= K:
  cost = K * X + (N - K) * Y
else:
  cost = N * X

print(cost)

Solution (Python):
url = "https://atcoder.jp/contests/abc044/tasks/abc044_a"

def main():

    n = [int(input()) for i in range(4)]
    if n[0] > n[1]:
        n1 = (n[0] - n[1]) * n[3]
        n2 = n[1] * n[2]
    else:
        n1 = 0
        n2 = n[0] * n[2]
    print(n1 + n2)


if __name__ == '__main__':
    main()

Solution (Python):
d=[int(input()) for i in range(4)];s=d[0]-d[1]
print(d[1]*d[2]+s*(d[3] if s>0 else d[2]))

Solution (Python):
N=int(input())
K=int(input())
X=int(input())
Y=int(input())
if N<=K: print(X*N)
else: print(K*X+(N-K)*Y)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N-K <= 0:
    price = N*X
else:
    price = K*X +(N-K)*Y
print(price)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n <= k:
    print(x * n)
else:
    print( x * k + y * (n - k))

Solution (Python):
N = input()
K = input()
X = input()
Y = input()
if K < N:
    print K * X + (N - K) * Y
else:
    print N * X

Solution (Python):
N = int(input())
K = int(input())
x = int(input())
y = int(input())
if N <= K:
  print(N*x)
else:
  print(K*x+(N-K)*y)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N <= K:
    print(X*N)
else:
    print(X*K + (N-K)*Y)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n <= k:
    ans = x * n
else:
    ans = x * k + (n - k) * y

print(ans)

Solution (Python):
N, K, X, Y = (int(input()) for i in [0]*4)
print(N*X - (X-Y)*max(N-K, 0))

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

amount = 0
if n <= k:
    amount = n * x
else:
    amount = k * x
    amount += (n - k) * y
print(amount)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n > k:
    print(k * x + (n - k) * y)
else:
    print(n * x)

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

total = 0
if N <= K:
    total += X*N
else:
    total += X*K
    total += Y*(N - K)
print(total)

Solution (Python):

n = int(input())
k = int(input())
x = int(input())
y = int(input())

amount = 0
if n < k:
    amount = n * x
else:
    amount = (k * x) + ((n - k) * y)

print(amount)

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n >= k:
  print((k * x) + ((n - k) * y))
else:
  print((n * x))

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n<=k:
  print(n*x)
else:
  print(k*x + (n-k)*y)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
if(a<b):
    b=a

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