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

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

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

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

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

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

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

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

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

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

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

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

if a <= b:
  print(a*c)
if a > b:
  e = a-b
  print(b*c+e*d)

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


if __name__ == '__main__':
    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())
    print(execute(n, k, x, y))

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

stay_k = n if k > n else k
stay_after = (n - k) if n > k else 0

print(stay_k * x + stay_after * y)

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

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

Solution (Python):
N,K,X,Y=[int(input())for _ in' '*4];print(X*N+(X-Y)*(K-N)*(K<N))

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

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

def price(N, K, X, Y):
    if N < K:
        return N * X
    else:
        return K * X + (N-K) * Y

print(price(N, K, X, 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 range(4)]
print(n*x-(x-y)*max(n-k,0))

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

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

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

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

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

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

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

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

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


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

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

Solution (Python):

a = int(input())
b = int(input())
c = int(input())
d = int(input())

s = 0
for i in range(a):
    if i < b:
        s += c
        continue
    s += d
print(s)

Solution (Python):



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


if __name__ == "__main__":
    main()

Solution (Python):
from statistics import mean, median,variance,stdev
import sys
import math





x = int(input())
y = int(input())
z = int(input())
a = int(input())


if x <= y: print(x*z)
else :print(y*z+(x-y)*a)

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

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

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

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

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

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

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

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 = [int(input()) for _ 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())
x_day = min( [n,k] )
y_day = max( [0,n-k])
print( x*x_day + y*y_day )

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

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

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

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

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

print(sum)

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

Solution (Python):
import sys
import math
import collections
import itertools
import array
import inspect


sys.setrecursionlimit(1000000)



def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))



def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v



def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk



def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False



dp = None


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

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


main()

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

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

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

summary = 0

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

print(summary)

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 + Y * (N - K))

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

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

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

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

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

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

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

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

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

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

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

    print(res)


if __name__ == "__main__":
    main()

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

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

lat = 0 if N < K else N - K

print((N-lat) * X + lat * Y)

Solution (Python):
N = input()
K = input()
X = input()
Y = input()
if(X < Y):
	tmp = X
	X = Y
	Y = tmp

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

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

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

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

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
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())
count = 0
for i in range(1,a+1):
    if i > b:
        count += d
    else:
        count += c
print(count)

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

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

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


if __name__ == "__main__":
    main()

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

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

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

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

Solution (Python):
days_to_stay = int(input())
special_days = int(input())
normal_price = int(input())
special_price = int(input())
payment = 0 

if days_to_stay <= special_days:
    payment = days_to_stay * normal_price
else:
    payment = (days_to_stay - special_days) * special_price + special_days * normal_price
    
print(payment)

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

Solution (Python):




"""
制約
    1 ≤ N,K ≤ 10000
    1 ≤ Y < X ≤10000
    N, K ,X ,Y はいずれも整数である
"""


def main():
    """
    全体の処理を実行するmain関数
    """
    N = int(input())  
    K = int(input())  
    X = int(input())  
    Y = int(input())  

    charges = 0 

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

    print(charges)
    

if __name__ == '__main__':
    main()

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

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

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

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

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

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


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


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

Solution (Python):

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

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


Z = N - K



if Z >= 0:
    mae = K * X
    ato = Z * Y
    print(mae + ato)
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())

ans = 0

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

    else:
        ans += y

print(ans)

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

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

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

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

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

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

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

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

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

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

if n < k:
    a, b = n, 0
else:
    a, b = k, n - k

print(a * x + b * y)

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

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

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

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

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

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

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

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

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

Solution (Python):
a,b,c,d=[int(input())for i in[0]*4]
print(a*c-(c-d)*max(a-b,0))

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

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

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

Solution (Python):
n = [int(input()) for _ in range(4)]

if n[0] > n[1]:
    print(n[3] * (n[0]-n[1]) + n[2] * n[1])
else:
    print(n[2]*n[0])
exit(0)

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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