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

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

print(z)

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

n, k, x, y = map(int, sys.stdin.read().split())

def main():
    if n > k:
        return x * k + y * (n - k) 
    return x * n

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

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

xk = min(k, n)
yk = max(0, n - k)

print(xk * x + yk * 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())

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

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

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

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

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

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

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

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

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

Solution (Python):

N = int(input())



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



first = min(K,N) * X


if N-K >0:
    
    after = (N-K) * Y
else:
    
    after = 0


print(first + after)

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

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

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

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

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

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

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

print(ans)

Solution (Python):



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

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

print(R)

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

if N > K:
    first_prize = K * X
    second_prize = (N - K) * Y
    total_prize = first_prize + second_prize
else:
    total_prize = N * X

print(total_prize)

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

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

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

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

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

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

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

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

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

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

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

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

total = 0

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

print(total)

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

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

print(ans)

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

Solution (Python):
stay_day = int(input())
first_stay_day = int(input())
first_stay_cost = int(input())
second_stay_cost = int(input())

if stay_day <= first_stay_day:
    cost = first_stay_cost * stay_day
elif stay_day > first_stay_day:
    cost = first_stay_cost * first_stay_day + second_stay_cost * (stay_day - first_stay_day)

print(cost)

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

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

S = N - K

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

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

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

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

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

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

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

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

print(ans)

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

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

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

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, k, x, y = map(int, list(input() for i in range(4)))
if k <=n:
    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<=0:
  print(a*c)
else:
  print(b*c+(a-b)*d)

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

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

print(ans)

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

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

else:
    print(N*X)

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

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

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

before_fee = 0
after_fee = 0

if N >= K:
    before_fee = K * X
    if N > K:
        after_fee = (N-K) * Y
else: 
    before_fee = N * X

print(before_fee + after_fee)

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    *a,=map(int,open(0).read().split())
    print((min(a[:2])*a[2])+max(0,(a[0]-a[1]))*a[3])
if __name__ == '__main__':
    main()

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

t = 0

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

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

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

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

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

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

print(k*x+y*nk)

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

if a>b:
  print(b*x+(a-b)*y)
else:
  print(a*x)

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

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

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

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

if __name__ == '__main__':
    main()

Solution (Python):


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

print(int(N<K)*(N*X)+int(N>=K)*(K*X+(N-K)*Y))

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

Solution (Python):


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

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

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

Solution (Python):

import sys, math, itertools, heapq, collections, bisect, fractions
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

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

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

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

print(cost)

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

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

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

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

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

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

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

print(answer)

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

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

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

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

Solution (Python):

import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

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

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(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(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 K > N:
    ans = N*X
    print(ans)
else:
    ans = K*X + (N-K)*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):
def examA():
    N = I(); K = I(); X = I(); Y = I()
    sum = 0
    sum += min(N,K)*X
    sum += max(N-K,0)*Y
    ans = sum
    print(ans)
   
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()

Solution (Python):

import sys
input = sys.stdin.readline


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

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

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

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

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

print(ans)

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

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

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

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

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

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

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

cost = 0
for n in range(N):
    if n < K:
        cost += X
    else:
        cost += Y

print(cost)

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

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

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

Solution (Python):


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

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

print('%d' %(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):
a,b,c,d=(int(input()) for i in range(4))
print(a*c - (c-d)*max(a-b,0))

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

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

result = 0

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

print(result)

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

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

if N<K: ans = N*X
else: ans = K*X

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

Solution (Python):


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

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

Solution (Python):
N=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+1) <= k):
        ans += x;
    else:
        ans += y;

print(ans);

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

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

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

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

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

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

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

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

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

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

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

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

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

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 = map(int,open(0).read().split())
S = 0

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

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

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

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

Solution (Python):
NKXY = list(map(int,[input() for i in range(4)]))
ans=0
for i in range(NKXY[0]):
  if i <NKXY[1] :
    ans+=NKXY[2]
  else:
    ans+=NKXY[3]
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 print(N*X)]

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
print(c*min(a,b)+d*max(0,a-b))

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

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

total = 0
for i in range(n):
  price = x
  if i + 1 > k:
    price = y
  total += price

print(total)

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

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


if __name__ == '__main__':
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())
    print(main(N, K, X, Y))

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

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

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

else:
    for i in range(1,N+1):
        a+=X
print(a)

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

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

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

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

print(sum)

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

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

Solution (Python):



syukuhaku_kei = int(input())
rennzoku = int(input())
tousyo = int(input())
rennpaku  = int(input())

if syukuhaku_kei > rennzoku:
    first_sum = rennzoku*tousyo
    second_sum = (syukuhaku_kei - rennzoku) * rennpaku
    goukei = first_sum + second_sum
    print(str(goukei))
    
else:
    goukei = syukuhaku_kei* tousyo
    print(str(goukei))

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

ans = 0

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

print(ans)

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

if n - k > 0:
    sum = k * x + (n - k) * y

else:
    sum = n * x
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):
a = [int(input()) for i in range(4)]
N=a[0]
K=a[1]
X=a[2]
Y=a[3]
if N<K:
    print(N*X)
else:
    print(X*K+(N-K)*Y)

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

Solution (Python):
if __name__ == "__main__":
    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())
first_half = K * X if N - K > 0 else N * X
rest = N - K if N - K > 0 else 0
print(first_half + rest * 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):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if (n > k):
    fee = x * k + y * (n - k)
else:
    fee = x * n
print(fee)

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

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

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

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

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

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