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

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

Solution (Python):

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

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

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

elif N > K:
    a = K * X + (N - K) * Y
    print(a)

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

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

Solution (Python):
import sys
n,k,x,y=map(int,sys.stdin)
print(x*min(n,k)+(n-k)*(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(raw_input())
k = int(raw_input())
x = int(raw_input())
y = int(raw_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 = 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(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
for i in range(N):
    if i <= (K - 1):
        total += X
    else:
        total += Y
print(total)

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

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
z=0
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:
    res = X*N
else:
    res = (X*K) + (Y*(N-K))

print (res)

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

Solution (Python):
a=[input() for i in range(4)]
n=int(a[0])
k=int(a[1])
x=int(a[2])
y=int(a[3])
cost=0

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

print(cost)

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

a = min(N,K)
print X*a + Y*(N-a)

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

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

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

Solution (Python):
l = [int(input()) for i in range(4)]
if l[0]<=l[1]:
    print('{}'.format(l[0]*l[2]))
else:
    print('{}'.format(l[1]*l[2]+(l[0]-l[1])*l[3]))

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=input()
k=input()
print(n if n<k else k)*input()+(0 if n<k else n-k)*input()

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

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):
a= [int(input()) for i in range(4)] 



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

Solution (Python):
if __name__ == '__main__':
    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())
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())

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

print(sum)

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

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

Solution (Python):

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

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

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

print(cost(N, K, X, Y))

Solution (Python):

n = int(input())

k = int(input())

x = int(input())

y = int(input())

if n < k:
    k = n

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

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

Solution (Python):
inn = int(input())
ink = int(input())
inx = int(input())
iny = int(input())

if inn <= ink:
  print(inn*inx)
else:
  print(ink*inx+(inn-ink)*iny)

Solution (Python):
def calc(n, k, x, y):
	if n < k: return n * x
	else: return k * x + (n-k) * y

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

print calc(N, K, X, Y)

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):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

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

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

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





if __name__ == '__main__':
    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())
    diff = n - k

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

Solution (Python):
def inpn(): return int(input())
N, K, X, Y = inpn(), inpn(), inpn(), inpn()
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
import io


def run(input: io.TextIOBase, output: io.TextIOBase):
    n = int(input.readline())
    k = int(input.readline())
    x = int(input.readline())
    y = int(input.readline())

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

    output.write(str(r) + '\n')


if __name__ == '__main__':
    run(sys.stdin, sys.stdout)

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

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

Solution (Python):
import math
import sys

def getinputdata():

    
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

n = int(arr_data[0][0])
k = int(arr_data[1][0])
x = int(arr_data[2][0])
y = int(arr_data[3][0])


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

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

Solution (Python):

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

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

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
a=0
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())
print(x*min(n,k)+y*max(n-k,0))

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
if a>=b:
  print(int((b*c)+((a-b)*d)))
else:
  print(int(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(raw_input())
k = int(raw_input())
x = int(raw_input())
y = int(raw_input())
print min(k, n) * x + (n - k) * y if n > k else min(k, 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 K<=N:
  print(K*X+(N-K)*Y)
else:
  print(X*N)

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):
n = int(input())
k = int(input())
x = int(input())
y = int(input())

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

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

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

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

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

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):
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 _ in range(4))
if n<=k:
  print(n*x)
else:
  print(k*x+(n-k)*y)

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

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


if __name__ == '__main__':
    main()

Solution (Python):

"""
https://beta.atcoder.jp/contests/abc044/tasks/abc044_a

"""
import sys
from sys import stdin
input = stdin.readline


def solve(N, K, X, Y):
    total = 0
    if N > K:
        total += X * K
        total += Y * (N - K)
    else:
        total += X * N
    return total


def main(args):
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())
    ans = solve(N, K, X, Y)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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

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

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

Solution (Python):





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

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

if __name__ == "__main__": main()

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

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

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

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
sum = 0
if N <= K:
    for i in range(0,N):
        sum = sum + X
if N >= K + 1:
    for i in range(0,K):
        sum = sum + X
    for i in range(K,N):
        sum = sum + Y
print(sum)

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

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

    print(total)


if __name__ == "__main__":
    main()

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

print(min(K,N)*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(0,(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 = int(input())
K = int(input())
X = int(input())
Y = int(input())

num = 0

for i in range(N):
    if (i + 1) > K:
        num += Y
    else:
        num += X

print(num)

Solution (Python):

import math
import sys
import itertools
import numpy as np
import functools
import collections
mo = 1000000007
INF = 10**100
r = range

class infix(object):
    def __init__(self, function):
        self.function = function

    def __ror__(self, other):
        self.left = other
        return self

    def __or__(self, other):
        return self.function(self.left, other)

    def __call__(self, value1, value2):
        return self.function(value1, value2)

@infix
def c(f_t_u, f_u_r): return lambda t: f_u_r(f_t_u(t))

class _Ap(object):
    def __rlshift__(self, other):
        self.value = other
        return self

    def __rshift__(self, other):
        return other(self.value)
Ap = _Ap()
ap = Ap






n = input()<<ap>>(int)
k = input()<<ap>>(int)
x = input()<<ap>>(int)
y = input()<<ap>>(int)

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

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(n-k, 0)*y)

Solution (Python):
from sys import stdin, stdout
def readLine_int_list():return list(map(int, stdin.readline().split()))
def readLine_int_list_reverse(): return list(map(int, stdin.readline().split())).reverse()
def readAll_int(): return list(map(int, stdin))
def readLine_str_list():return list(map(str, stdin.readline().split()))
def readAll_str(): return list(map(str, stdin))
def readLine_int_set(): return set(list(map(int, stdin.readline().split())))
def g_twoD_list(p,q): return [[0 for i in range(p)] for j in range(q)]


def main():
    n,k,x,y = readAll_int()
    print(k*x + (n-k)*y if n-k > 0 else n*x)
    
if __name__ == "__main__":
    main()

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

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

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())
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[0]*4];print(min(n,k)*x+max(0,n-k)*y)

Solution (Python):
a=[int(input())for i in[0]*4];print(min(a[:2])*a[2]+max(0,a[0]-a[1])*a[3])

Solution (Python):
a=[int(input())for i in[0]*4];print(min(a[0],a[1])*a[2]+max(0,a[0]-a[1])*a[3])

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

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
a = min(K, N)
b = max(N-K, 0)
print(a*X+b*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(raw_input())
k = int(raw_input())
x = int(raw_input())
y = int(raw_input())
total = 0
if n <= k:
	total += n*x
else:
	total += k*x + (n-k)*y
print(total)

Solution (Python):

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

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

print(res)

Solution (Python):

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

O = max(0, N - K) 
P = N - O         

res = P * X + O * Y

print(res)

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 _ in range(4)]
print(x*min(n, k)+y*max(0, n-k))

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

Solution (Python):
n = int(raw_input())
k = int(raw_input())
x = int(raw_input())
y = int(raw_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())
ans = 0
for i in range(n):
    if i < k:
        ans += x
    else:
        ans += y
print(ans)

Solution (Python):
from collections import defaultdict


def main():
    N, K, X, Y = int(input()), int(input()), int(input()), int(input())
    ans = 0
    for i in range(N):
        ans += X if i < K else 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(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())

A=0

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

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

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N <= K:
    ans = N * X
    print(ans)
else:
    a = K * X
    b = (N - K) * Y
    ans = a + b
    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):
def ini(): return int(input())
def inli(): return list(map(int, input().split()))
def inf(): return float(input())
def inlf(): return list(map(float, input().split()))
def inl(): return list(input())
def pli(): return "".join(list(map(str, ans)))

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

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

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

Solution (Python):
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def ris(): return list(input())
def pli(): return "".join(list(map(str, ans)))

N = ri()
K = ri()
X = ri()
Y = ri()

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

Solution (Python):
N = input()
K = input()
X = input()
Y = input()
print N*Y + min(N,K)*(X-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(raw_input())
K = int(raw_input())
X = int(raw_input())
Y = int(raw_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 K>N:
  print(N*X)
else:
  print(K*X+(N-K)*Y)

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

main()

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

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

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

Solution (Python):


import os, sys
import math

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

Solution (Python):



def input_strs():
    return input().split(" ")

def input_nums():
    return [int(i) for i in input_strs()]


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

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

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

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

Solution (Python):
a = [int(input()) for i in range(4)]
sum = 0
for i in range(a[0]):
    if i + 1 <= a[1]:
        sum += a[2]
    else:
        sum += a[3]
print(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):
import sys

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    N = int(input())
    K = int(input())
    x = int(input())
    y = int(input())

    ans = x * min(N, K) + y * max(N - K, 0)

    print(ans)

if __name__ == '__main__':
    solve()

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

Solution (Python):


def main():
    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)

if __name__ == '__main__':
    main()

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

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

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7


def main():
    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())
    r = x * min(n,k)
    r += y * max(0,n-k)
    return r



print(main())

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