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

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

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

Solution (Python):

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

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

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

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

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

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

if __name__ == '__main__':
    main()

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

cost = 0
for i in range(1, data[0]+1):
    if( i <= data[1] ):
        cost += data[2]
    else:
        cost += data[3]
print(cost)

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

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

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

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

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

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

print (ans)

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

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

z = 0
z += min(n, k) * x
if n > k:
  z += (n - k) * y
print(z)

Solution (Python):
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N = n()
K = n()
X = n()
Y = n()


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

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


abc()

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

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

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

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

Solution (Python):

import copy
import random
import bisect 
import fractions 
import math
import sys

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

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())

N = I()
K = I()
X = I()
Y = I()

ans = 0
for i in range(N):
    if i >= 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())

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

bill = 0

for i in range(n):
    i += 1
    if k >= i:
        bill += x
    elif k < i:
        bill += y

print(bill)

Solution (Python):
day_all = int(input())
day_nor = int(input())
pay_nor = int(input())
pay_sar = int(input())
bonus = 0
if day_all > day_nor:
    bonus = pay_sar * (day_all - day_nor)
    pay_all = day_nor * pay_nor + bonus
else:
    pay_all = day_all * pay_nor
print(pay_all)

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, K, X, Y = [int(input()) for _ in range(4)]

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

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

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

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

print(price)

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

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

Solution (Python):
def smaller(x, y):
	if x < y: return x
	return y

def larger(x, y):
	if x > y: return x
	return y

N = int(input())
K = int(input())
X = int(input())
Y = int(input())
print(X*smaller(K, N)+Y*larger(0, 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):
def abc():
    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())

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


abc()

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

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

Solution (Python):


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

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

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

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

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

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

print(price)

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

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

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

Solution (Python):
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

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

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

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

price = 0

if K > N:
    K = N

for i in range(0, K):
    price += X

for i in range(K, N):
    price += Y

print(price)

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

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

Solution (Python):
n=int(input())
k=int(input())
c=int(input())
d=int(input())

ans=0
for i in range(n):
  if i<k:
    ans+=c
  else:
    ans+=d
print(ans)

Solution (Python):
day, slit, fee1, fee2 = [int(input()) for i in range(4)]

total = 0

for j in range(day):
    if j < slit:
        total += fee1
    else:
        total += fee2



print(total)

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

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

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

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

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

Solution (Python):

import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())


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

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

print(ans)

Solution (Python):

import itertools
import sys
import math
from functools import lru_cache





from queue import Queue
from operator import mul
from functools import reduce
from queue import Queue
from operator import mul
from functools import reduce
from functools import lru_cache

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

import itertools
import sys
import math
from functools import lru_cache





from queue import Queue
from operator import mul
from functools import reduce
from queue import Queue
from operator import mul
from functools import reduce
from functools import lru_cache

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

    r = 0

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

    print(r)


if __name__ == '__main__':
    main()

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, = list(map(int,input().split()))
K, = list(map(int,input().split()))
X, = list(map(int,input().split()))
Y, = list(map(int,input().split()))
print(X*min(K,N)+Y*max(0,N-K))

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
ans = min(N, K) * X + max(N - K, 0) * 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())






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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
all_days=int(input())
days1=int(input())
sp_p=int(input())
n_p=int(input())
ans = 0

if all_days <= days1:
    ans = sp_p * all_days
else:
    ans = days1 * sp_p + (all_days-days1) * n_p

print(ans)

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

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

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

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

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
a=b=i=0
if n<=k:
 for i in range(n):
   a+=x
   i+=1
else:
 for i in range(k):
   a+=x
   i+=1 
i=0
if n>k:
 for i in range(n-k):
   a+=y
   i+=1
print(a)

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

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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
Alldays=int(input())
days1=int(input())

cost1=int(input())
cost2=int(input())

if Alldays-days1<0:
	print(Alldays*cost1)

else:
	print(days1*cost1+(Alldays-days1)*cost2)

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


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


print(sum)

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

amount = 0

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

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

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

n, k, x, y = n
print(x * (n if n <= k else k) + max(0, (n - k)) * y)

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

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

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

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

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

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

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

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

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

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

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

res = 0
for i in range(N):
    if (i < K):
        res += x
    else:
        res += y

print(res)

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


if __name__ == '__main__':
	main()

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

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

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

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

amount = 0

if N <= K:
    K = N
    L = 0
else:
    L = N - K



amount = K * X + L * Y

print(amount)

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

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

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

Solution (Python):
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import sys

sys.setrecursionlimit(10000)
INF = float('inf')



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

ans =0
while K > 0 and N > 0:
    K-=1
    N-=1
    ans += X
while N > 0:
    N-=1
    ans += Y
print(ans)

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

if __name__ == "__main__":
    main()

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

cost = 0
day = 0
while day < N:
    if(day < K):
        cost += X
    else:
        cost += Y
    day += 1

print(cost)

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

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

Solution (Python):


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

    return n, k, x, y


def submit():
    n, k, x, y = read_input()

    c_x = min(n, k)
    c_y = max(0, n - k)

    print(c_x * x + c_y * y)

if __name__ == '__main__':
    submit()

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

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

Solution (Python):


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

if __name__ == '__main__':
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())
    
    solve(N,K,X,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())

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

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

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

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

print(min(a,b)*c + max(a-b,0)*d)

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

s=0

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

print(s)

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

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

Solution (Python):
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())

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


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

Solution (Python):

n, k, x, y= list(map(int, [input().rstrip() for _ in range(4)]))
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())

tot = 0
if N < K:
    tot = N * X
else:
    remainder = N - K
    tot = K * X + remainder * Y

print(tot)

Solution (Python):

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

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

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

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

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

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

Solution (Python):
total = int(input())
limit = int(input())
first = int(input())
second = int(input())
if total > limit:
	print(limit * first + (total - limit) * second)
else:
  	print(total * first)

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

money = 0

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

print(money)