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):
import sys
from fractions import gcd
import bisect
 
stdin = sys.stdin
 
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
s = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
k = ni()
x = ni()
y = ni()

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

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

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,K,X,Y = [int(input()) for i in range(4)]

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

Solution (Python):
N,K,X,Y=[int(input()) for i 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())

if n-k > 0:
    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 k*x + (n-k)*y)

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

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,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())
print(N*X if N <= K else K*X+(N-K)*Y)

Solution (Python):
def A_TakandHotels():
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())
    ans = 0
    if K < N:
        ans = X * K + (N-K) * Y
    else:
        ans = X * N
    print(ans)
    
if __name__ == "__main__":
    A_TakandHotels()

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

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

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

Solution (Python):
import sys
import bisect
input = sys.stdin.readline
 
def main():
    n=int(input())
    k=int(input())
    x=int(input())
    y=int(input())
    
    if(n<=k):
        k=n
    
    print(k*x+(n-k)*y)
    
main()

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

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:
  price = k * x
  price = price + (n - k) * y
elif n <= k:
  price = n * x
  
print(price)

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

sum1 = (k*x) 

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

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

ans = min(N, K) * X + max(N-K, 0) * 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(min(n, k)*x+max(n-k, 0)*y)

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

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

Solution (Python):
n, k, x, y = (int(input()) for i in [0]*4)
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(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(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:
    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 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())

fee = 0

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

print(fee)

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,K,X,Y=[int(input()) for i in range(4)]
print(X*N if N<=K else X*K+Y*(N-K))

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())
print(K*X + (N-K)*Y if N >= K else X*N )

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

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, k, x, y = [int(input()) for i in range(4)]

if n-k >= 1:
  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 :
    ans = X * K + Y * (N - K)
    print(int(ans))
else:
    ans = X * N
    print(int(ans))

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

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())
print(n*x if k > n else k*x + (n - k)*y)

Solution (Python):
a,b,c,d=[int(input()) for i in range(4)]
print(a*c-(c-d)*max(a-b,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:
	kane=k*x+(n-k)*y
else:
	kane=n*x
print(kane)

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):
import sys
N,K,X,Y = map(int, sys.stdin.readlines())

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

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

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

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 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 K + 1 <= N:
    Z = (X * K) + (Y * (N - K))
    print(Z)
else:
    Z = X * N
    print(Z)

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(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(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, K, X, Y = [int(input()) for _ in range(4)]
print(min(N, K) * X + max(0, N - K) * Y)

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:
    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())
print((k*x+(n-k)*y,n*x)[k>=n])

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

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

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

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

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

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

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, K, X, Y = (int(input()) for i in range(4))
print (K * X + (N - K) * Y if N > K else N * X)

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 = int(input())
K = int(input())
X = int(input())
Y = int(input())

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

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
ans = 0
for i in range(n):
  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(X*N)
else:
    print(X*K + Y*(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,k,x,y=int(input()),int(input()),int(input()),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())
total = 0
for i in range(n):
    if i < k:
        total += x
    else:
        total += y
print(total)

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

charge = 0

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

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

price = min(N, K) * X

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

print(price)

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

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
s = n*x*(n<k+1) + k*x*(n>k) +(n-k)*(n>k)*y
print(s)

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

Solution (Python):
w = [input() for i in range(4)]
N = int(w[0])
K = int(w[1])
X = int(w[2])
Y = int(w[3])

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

print(paid)

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

a=K
b=N-K
c=N

if b>0:
	print(a*X+b*Y)
else:
	print(c*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, k, x, y = [int(input()) for i in range(4)]
if n > k:
    syogaku = k * x
    sagaku = (n - k) * y
    print(syogaku + sagaku)
else:
    syogaku = n * x
    print(syogaku)

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

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

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

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

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

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

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

Solution (Python):
n,k,x,y = [int(input()) for _ in [0]*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())
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(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(X*N)
else:
  print(X*K + Y * (N-K))

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

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

print(sum)

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())

c = 0

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

print(c)

Solution (Python):
N, K, X, Y = map(int, open(0).read().split())

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

Solution (Python):
a, b, c, d = int(input()), int(input()), int(input()), int(input())
sum = 0
for i in range(1, a + 1):
    if i > b:
        sum += d
    else:
        sum += c

print(sum)

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

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

Solution (Python):
day = int(input())
d_line = int(input())
fee1 = int(input())
fee2 = int(input())

if day > d_line:
    total = d_line * fee1 + (day-d_line) * fee2
else:
    total = day * fee1
print(total)

Solution (Python):



if __name__ == '__main__':
    n, k, x, y = [int(input()) for _ in range(4)]
    print(min(n, k) * x + max(n - k, 0) * 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+y*(n-k))

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

Solution (Python):
import sys
 
nN = int(input())
nK = int(input())
nX = int(input())
nY = int(input())
 
nE = 0
nAns = 0
 
if nN <= nK:
  nAns = nX * nN
  print(nAns)
  sys.exit()
  
nE = nN - nK
 
nAns = (nX * nK) + (nY * nE)
print(nAns)

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,K,X,Y=[input() for i in range(4)]
N=int(N)
K=int(K)
X=int(X)
Y=int(Y)

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

print(fee)

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

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(K*X+(N-K)*Y)
else:
  print(N*X)

Solution (Python):
n,k,x,y=[int(input()) for i 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(n*x)
else:
  print(k*x+(n-k)*y)

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

sum = 0

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

Solution (Python):
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)

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

Solution (Python):

import sys
sys.setrecursionlimit(300000)


def solve(N: int, K: int, X: int, Y: int):
    ret = X * min(N, K) + Y * max(0, N - K)
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    X = int(next(tokens))  
    Y = int(next(tokens))  
    solve(N, K, X, Y)

if __name__ == '__main__':
    main()

Solution (Python):

from  collections import Counter
import sys

def main():
    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())

    ans = min(n, k) * x + (n - min(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:
    s = n*x
    
else:
    s = k * x + (n-k)*y
print(s)

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

answer = min(k,n)*x
if n>k:
  answer += (n-k)*y
print(answer)

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

if N >= K:
  print(Y*(N-K) + K*X)
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(min(n, k) * x + max(n - k, 0) * 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())

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

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)]
if N==0:
  print(0)
elif 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
for i in range(n):
  if i >k-1:
    fee += y
  else:
    fee += x
print(fee)

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(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 >= 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())
ans = 0

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

print("{}".format(ans))

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())

sm = 0

for i in range(n):
  if i >= k:
    sm += y
  else:
    sm += x
    
print(sm)

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):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
if b>=a :
  print(a*c)
else :
  print(b*c + (a-b)*d)

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

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

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

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

s = 0

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

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 * N if N <= K else X * K + Y * (N - K))

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(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):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
k = INT()
x = INT()
y = INT()

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

Solution (Python):
def smaller(x, y):
	if x < y:
		return x
	return y

N = int(input())
K = int(input())
X = int(input())
Y = int(input())
sum = 0
for i in range(0, smaller(N, K)):
	sum += X
for i in range(K, N):
	sum += Y
print(sum)

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:
    cost = N * X
    print(cost)
else:
    cost = K * X + (N - K) * Y
    print(cost)

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

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

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

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(n*x) if n<k 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 + Y * (N - K))

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

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())
print(sum([c if i < b else d for i in range(a)]))

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())
sum = 0
for i in range(N):
    if i>K-1:
        sum += Y
    else:
        sum += X
print(sum)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    n = II()
    k = II()
    x = II()
    y = II()
    ans = 0
    for i in range(n):
        if i >= k:
            ans += y
        else:
            ans += x
    print(ans)
    return


def B():
    return


def C():
    return


def D():
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == '__main__':
    A()

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    n, k, x, y = II(),II(),II(),II()
    ans = 0
    for i in range(n):
        if i >= k:
            ans += y
        else:
            ans += x
    print(ans)
    return


def B():
    return


def C():
    return


def D():
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == '__main__':
    A()

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    n, k, x, y = IR(4)
    ans = 0
    for i in range(n):
        if i >= k:
            ans += y
        else:
            ans += x
    print(ans)
    return


def B():
    return


def C():
    return


def D():
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == '__main__':
    A()

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())

f = min(n, k)
s = max(0, n - f)
print(f * x + s * 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):
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(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())

print(min(a, b) * c + max(a - b, 0) * d)

Solution (Python):



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

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

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

Solution (Python):
n,k,x,y =[int(input()) for _ in range(4)]
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, K, X, Y = [int(input()) for i in range(4)]
if N <= K:
  print(N*X)
else:
  print(K*X + (N-K)*Y)

Solution (Python):


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

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

if __name__ == "__main__":
    solve()

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(x * k + y * (n - k))
else:
    print(x * n)

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

Solution (Python):
from sys import stdin
N, K, X, Y = map(int,stdin.read().splitlines())
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())

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

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