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

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

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

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

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

Solution (Python):
import sys
s=[input() for i in range(4)]
sum=0

for N in range(1,int(s[0])+1):
    if N < int(s[1])+1:
        sum += int(s[2])
    else:
        sum += int(s[3])
    

print(sum)

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

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

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

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

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    k = int(input().rstrip('\n'))
    x = int(input().rstrip('\n'))
    y = int(input().rstrip('\n'))
    t = 0
    for i in range(n):
        if i + 1 > k:
            t += y
        else:
            t += x
    print(t)


if __name__ == '__main__':
    slove()

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

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

else:
	cost = N * X

print(cost)

Solution (Python):



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


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

Solution (Python):
import sys

input = sys.stdin.readline


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


if __name__ == "__main__":
    main()

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

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

print(sum([X if _ < K else Y for _ in range(N)]))

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 i in range(4)]


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

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

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

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, 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:
  S=X*K+Y*(N-K)

elif N < K:
  S=N*X

print(S)

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

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

elif N < K:
  S=N*X

print(S)

Solution (Python):

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

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

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

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

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 += Y
    else:
        fee += X

print(fee)

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

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

Solution (Python):


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

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

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):
l=[int(input()) for i in range(4)]
print(l[0]*l[2] if l[0]<=l[1] else l[1]*l[2]+(l[0]-l[1])*l[3])

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

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
def do():
    n = INT()
    k = INT()
    x = INT()
    y = INT()
    if n<=k:
        print(n*x)
    else:
        print(k*x+(n-k)*y)
if __name__ == '__main__':
    do()

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

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

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

acc = 0

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

print(acc)

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

N, K, X, Y = input_

acc = 0

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

print(acc)

Solution (Python):
N,K,X,Y = map(int,open(0).read().split())
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 N <= K:
    print(N*X)
else:
    print(X*K + Y*(N-K))

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


if __name__ == "__main__":
    resolve()

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

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

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

result = 0
for i in range(a[0]):
    result += a[3] if a[1] < i+1 else a[2]

print(result)

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

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 (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(n * x + (y-x) * 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):
import sys
input = sys.stdin.readline

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

if __name__ == "__main__":
    main()

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

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

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

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

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

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

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

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

total_amount = 0

for i in range(1, n+1):
  total_amount += (x  if i <= k else y)
  
print(total_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,K,X,Y=map(int,open(0));print([N*X,K*X+(N-K)*Y][K<N])

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=map(int,open(0));print([n*x,k*x+(n-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())

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

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

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

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

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

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

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

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

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

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):
days=int(input())
k=int(input())
yen_until_k=int(input())
yen_after_k=int(input())
if days <= k:
  print(days*yen_until_k)
else:
  print(k*yen_until_k+(days-k)*yen_after_k)

Solution (Python):
n, k, x, y = [int(input()) for _ in range(4)]
ans = 0
while n:
    if n <= k:
        ans += x
    else:
        ans += y
    n -= 1
else:
    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 = 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):
n,k,x,y = map(int,open(0))
price = 0
for i in range(n):
    if i+1 <= k :
        price += x
    else:
        price += y
print(price)

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

Solution (Python):
source = []
for i in range(4):
    source.append(input())
N = list(map(int, source))
N, K, X, Y = N[0], N[1], N[2], N[3]
if N <= K:
    print(N * X)
else:
    print((N - K) * Y + K * X)

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

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N=int(input())
K=int(input())
X=int(input())
Y=int(input())

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

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

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

Solution (Python):
import sys
from collections import deque

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n, k, x, y = [ni() for _ in range(4)]
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(K >= N):
    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 = int(input())
k = int(input())
x = int(input())
y = int(input())

x_sum = 0
if n < k:
  x_sum = n * x
else:
  x_sum = k * x

if n - k > 0:
  y_sum = (n - k) * y
else:
  y_sum = 0
  
print(x_sum + y_sum)

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

Solution (Python):
def main():                                                                     
  n, k, x, y = int(raw_input()), int(raw_input()), int(raw_input()), int(raw_input())
  total = 0                                                                     
  for i in xrange(1, n+1):                                                      
    total += x if i <= k else y                                                 
  print(total)                                                                  
                                                                                
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(X*N)

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

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

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

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

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

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

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

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

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

if __name__ == '__main__':
    print(main())

Solution (Python):
days = int(input())
boundary = int(input())
fee_before = int(input())
fee_after = int(input())

print(min(days, boundary)*fee_before+max(0, (days-boundary))*fee_after)

Solution (Python):
days = int(input())
boundary = int(input())
fee_before = int(input())
fee_after = int(input())

if days <= boundary:
    print(days*fee_before)
else:
    print(boundary*fee_before+(days-boundary)*fee_after)

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=int(input())
k=int(input())
x=int(input())
y=int(input())
if n<=k:
  print(n*x)
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(min(k, n) * x)

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

Solution (Python):
n,k,x,y=map(int,open(0));print(n*x 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:
    print(x*k+y*(n-k))
else:
    print(x*n)

Solution (Python):
import sys
input = sys.stdin.readline

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

import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 




 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    K = inputInt()
    X = inputInt()
    Y = inputInt()
    
    if N <= K:
        print(N*X)
    else:
        print((K*X) + ((N-K)*Y))
    
if __name__ == "__main__":
	main()

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
x=0
for i in range(a):
  if i < b:
    x += c
  else:
    x += d
print(x)

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

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

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

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

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:
    total_price = (X * N)

else:
    total_price = K * X + Y * (N - K)

print(total_price)

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

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

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

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)]
a = N*X

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

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

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

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

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

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

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

Solution (Python):
n,k,x,y=[int(input()) for _ in range(4)]
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())
print(X * min(K, N) + 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 = 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):
stay = int(input())
plan_change_day =int(input())
high_price=int(input())
low_price=int(input())
 
def main():
    if stay - plan_change_day > 0:
        cost = high_price * plan_change_day + low_price * (stay - plan_change_day)
        print(int(cost))
    else:
        cost = high_price * stay
        print(int(cost))
  	    
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):
inputs=[int(input()) for _ in range(4)]

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

print(ans)

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

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

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

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 [0]*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())
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())

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

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,b,c,d = [int(input()) for i in range(4)]
if a > b:
    print(b*c+(a-b)*d)
else:
    print(a*c)

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

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

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

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

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

print(ans)

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

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


if __name__ == "__main__":
    test()

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


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

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

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

Solution (Python):
n, k, x, y = [int(input()) for _ in range(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())
t = 0
for i in range(n):
    if i < k:
        t += x
    else:
        t += y
print(t)

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

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

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