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:
    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(n*x)
else :
    a = n - k
    print(k*x + a*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())
print([n*x,k*x+(n-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):
from sys import stdin

input=[]
for i in range(4):
  input.append(stdin.readline().strip())

end_t=int(input[0].strip())
start_t=int(input[1].strip())
start_c=int(input[2].strip())
end_c=int(input[3].strip())
sum=0
if end_t>start_t:
  sum=start_t*start_c+(end_t-start_t)*end_c
else:
  sum=end_t*start_c
print(sum)

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

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

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

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

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

Solution (Python):
n, k, x, y = [int(input()) for i in range(4)]
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):
A, B, C, X = map(int, open(0).read().split())
if A-B <= 0:
  print(A*C)
else:
  print(B*C + (A-B)*X)

Solution (Python):
from sys import stdin

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

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

Solution (Python):
max = int(input())
sam = int(input())
sam_num = int(input())
sam_later= int(input())

if(max<sam):
  print(sam_num*max)
else:
  print(sam_num * sam + sam_later * (max-sam))

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

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

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

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

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

print(en)

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

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

Solution (Python):
def tak_and_hotels(N: int, K: int, X: int, Y: int) -> int:
    return min(N, K) * X + max(0, N - K) * Y


if __name__ == "__main__":
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())
    ans = tak_and_hotels(N, K, X, Y)
    print(ans)

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

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

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

print(result)

Solution (Python):

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

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

print(result)

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

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

yado = 0
for i in range(1, N+1):
    if i <= K:
        yado += X
    elif i > K:
        yado += Y
print(yado)

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 = 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(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 * K + Y * (N-K) if N>K else 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, k, x, y = (int(input()) for _ in range(4))
print(x * min(k, n) + y * max(0, n - k))

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

Solution (Python):


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

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

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

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

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

Solution (Python):
from sys import stdin
input = stdin.readline
N, K, X, Y = [int(input().rstrip()) for _ in range(4)]
if N <= K:
	print(N * X)
else:
	print(X * K + (N-K) * Y)

Solution (Python):
a = int(input())
b = int(input())
p1= int(input())
p2= int(input())

c = a - b

print(a*p1 if a<b else b*p1 + c*p2)

Solution (Python):
def main():
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())
    charge = 0
    charge1 = 0
    charge2 = 0
    charge3 = 0
    if K <= N:
        charge1 += K*X
        charge2 += (N-K)*Y
        charge = charge1 + charge2
    else:
        charge3 += N*X
        charge = charge3
    print(charge)
main()

Solution (Python):
from functools import reduce

def main():
    
    

    
    

    
    
    
    
    

    
    
    N = int(input().rstrip())
    K = int(input().rstrip())
    X = int(input().rstrip())
    Y = int(input().rstrip())
    ans = 0
    if(N>K):
        ans = K*X + (N-K)*Y
    else:
        ans = N*X
    print(ans)   
   
if __name__ == '__main__':
    main()

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,K,X,Y = eval('int(input()),'*4)
print(K*X+(N-K)*Y if (N-K) > 0 else N*X)

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

from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007


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



"""
n,a = LI()
x = LI()
s = sum(x)
dp = [[[0 for i in range(s+1)] for j in range(n+1)] for k in range(n+1)]
for i in range(n+1):
    dp[i][0][0] = 1
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(s+1):
            if k >= x[i-1]:
                dp[i][j][k] = dp[i-1][j][k]+dp[i-1][j-1][k-x[i-1]]
            else:
                dp[i][j][k] = dp[i-1][j][k]
ans = 0
for i in range(1,n+1):
    if a*i <= s:
        ans += dp[n][i][a*i]
print(ans)
"""


"""
def f(b,n):
    m = n
    res = 0
    while m > 0:
        res += m%b
        m //= b
    return res
n,s = IR(2)
if n == s:
    print(n+1)
    quit()
if n == 1:
    print(-1)
    quit()
k = int(n**0.5)
for b in range(2,k+1):
    if f(b,n) == s:
        print(b)
        quit()
for p in range(1,k+1)[::-1]:
    if (n-s)%p == 0:
        b = (n-s)//p+1
        if b != 0:
            if f(b,n) == s:
                print(b)
                quit()
print(-1)
"""

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

Solution (Python):

def main():
  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])
  
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(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 +1:
		sum += Y
	else:
		sum +=X

print(sum)

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

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

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

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

N, K, X, Y = args


def solve():
    if N <= K:
        return N * X

    first = K
    second = N - first

    return first * X + second * Y

res = solve()
print(res)

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


if __name__ == "__main__":
    main()

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(K, N)*X + max((N-K),0)*Y)

Solution (Python):

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

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

print(fee)

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

res = 0

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

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

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

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

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

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

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

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

Solution (Python):
N=int(input())
K=int(input())
X=int(input())
Y=int(input())
print(str(min(N,K)*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):
def main() -> None:
    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())

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

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

Solution (Python):
a = [int(input()) for i in range(4)]
ans = 0

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

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):
from itertools import combinations, product


def gcd(a, b):
    if a < b:
        a, b = b, a
    while b != 0:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)


def get(fmt):
    ps = input().split()
    r = []
    for p, t in zip(ps, fmt):
        if t == "i":
            r.append(int(p))
        if t == "f":
            r.append(float(p))
        if t == "s":
            r.append(p)
    if len(r) == 1:
        r = r[0]
    return r

def put(*args, **kwargs):
    print(*args, **kwargs)


def rep(n, f, *args, **kwargs):
    return [f(*args, **kwargs) for _ in range(n)]
    
def rep_im(n, v):
    return rep(n, lambda: v)
    
YES_NO = ["NO", "YES"]


N, K, X, Y = rep(4, get, "i")

p = N * X - max(N - K, 0) * (X - Y)

put(p)

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

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

print(result)

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

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

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

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

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

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=eval('int(input()),'*4);print(c*min(a,b)+d*max(a-b,0))

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

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

print(ans)

Solution (Python):
n,k,x,y=eval('int(input()),'*4);print(n*x-(x-y)*max(n-k,0))

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

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

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

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

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

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

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



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

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

v = N - K
if 0 > v:
    r = N * X
else:
    
    r = K * X
    r += v * Y

print(r)

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

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

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

Solution (Python):
from sys import stdin
n = int(stdin.readline().rstrip())
k = int(stdin.readline().rstrip())
x = int(stdin.readline().rstrip())
y = int(stdin.readline().rstrip())
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(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:
    ans = n*x
else:
    ans = k*x+(n-k)*y
print(ans)

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

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

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

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

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

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

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

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

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

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

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

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

pay = 0

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

print(pay)

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

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

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

Solution (Python):
max_day, normal_day, pay, discount_pay = [int(input()) for _ in range(4)]
payment = 0

for i in range(max_day):
    if i < normal_day:
        payment += pay
    else:
        payment += discount_pay

print(payment)

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

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

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

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

print( ans )

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

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(min(K, N)*X + max(0,(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())
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())

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

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

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

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

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

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,k,x,y = map(int,[input() for _ in range(4)])
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(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())
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):
from collections import Counter, defaultdict, deque

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

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

print(ans)

Solution (Python):

n = 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 numpy as np
from collections import Counter, defaultdict, deque

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

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

print(ans)

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

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

print(ans)
print()

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

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

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 _ in [0]*4)
print(n*x if n<k else k*x+(n-k)*y)

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

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

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

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

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

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 if n>=k else 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):
""" AtCoder """

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

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

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

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

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