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

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

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

Solution (Python):
def iroha():
    n, k, price, special = [int(input()) for i in range(4)]
    result = 0
    for i in range(n):
        if i < k:
            result += price
        else:
            result += special
    print(result)

if __name__ == "__main__":
    iroha()

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

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

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

print(sum)

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

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

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

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

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

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

Solution (Python):
"""
ABC044 A 高橋君とホテルイージー
https://kenkoooo.com/atcoder/
"""

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


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


if __name__ == "__main__":
    main()

Solution (Python):
import math
from datetime import date

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

main()

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

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

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

if N >= 0:
  result += N * Y
print(result)

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

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

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

Solution (Python):
n,k,x,y = [int(input()) for i in range(4)]
cost = (min(n,k)*x+max(0,n-k)*y)
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())
first=min(n,k)
re=first*x
re+=max((n-first),0)*y
print(re)

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

Solution (Python):
total = int(input())
initial = int(input())
if initial > total:
  initial = total
a = int(input())
b = int(input())
count = 0
for i in range(initial):
  count+= a
for c in range(total - initial):
  count+=b

print(count)

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

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


if __name__ == "__main__":
    solve()

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

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

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

ans = min(n, k) * x
n -= min(n, k)

ans += n * 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())
ans = 0

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

print(ans)

Solution (Python):
class Combination:
    def __init__(self, n, mod):
        self.n = n
        self.mod = mod
        self.fac = [1 for i in range(self.n + 1)]
        self.finv = [1 for i in range(self.n + 1)]
        for i in range(2, self.n+1):
            self.fac[i] = (self.fac[i - 1] * i) % self.mod
            self.finv[i] = (self.finv[i-1] * pow(i, -1, self.mod)) % self.mod

    def comb(self, n, m):
        return self.fac[n] * (self.finv[n-m] * self.finv[m] % self.mod) % self.mod
def iparse():
    return list(map(int, input().split()))

if __name__ == "__main__":
    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,k,x,y = [int(input()) for _ 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(k*x+(n-k)*y)

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

Solution (Python):
import sys
from heapq import heappush, heappop, heapify
import math
from math import gcd
import itertools as it
from collections import deque 

input = sys.stdin.readline

def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))

INF = 1001001001



def main():
    n = inp()
    k = inp()
    x = inp()
    y = inp()
    if n > k:
        print(x * k + y * (n - k))
    else:
        print(x * n)

main()

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


sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

N = ini()
K = ini()
X = ini()
Y = ini()

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

if k > n:
    k = n

a = int(input())
b = int(input())

total = 0

for i in range(1,k+1):
    total += a

for j in range(k,n):
    total += b
    
print(total)

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


if __name__ == "__main__":
    main()

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

Solution (Python):
n=int(input())
k=int(input())
x=int(input())
y=int(input())
fees=0
if(k>n or n==k):
	for i in range(0,n):
		fees+=x
elif(k<n):
	diff=n-k
	for j in range(0,k):
		fees+=x
	for k in range(0,diff):
		fees+=y
		
print(fees)

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):
from sys import stdin
input = stdin.readline

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

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

print(cost)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

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

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

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

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

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 ((1 <= N & N <= 10000) & (1 <= K & K <= 10000)) \
        & (1 <= X & X <= 10000) & (1 <= Y & Y <= 10000):
    if (X > Y):
        price = 0
        if (N < K):
            for i in range(1, N + 1):
                price += X
        if (N >= K):
            for i in range(1, K + 1):
                price += X
            for j in range(K + 1, N + 1):
                price += Y
        print(price)

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

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

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

Solution (Python):
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    k = I()
    x = I()
    y = I()
    if n <= k:
        print(n*x)
    else:
        print(k*x + (n-k)*y)

if __name__ == '__main__':
    main()

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

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    K = int(readline())
    X = int(readline())
    Y = int(readline())

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

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):

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


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

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

if N - K > 0:
    total = (K * X) + ((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:
    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)*y, 0))

Solution (Python):









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




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

else:
    answer = n * x

print(answer)

Solution (Python):
import sys
N, K, X, Y = map(int, sys.stdin.readlines())
print(N*X if N <= K else K*X +Y*(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())
cost = 0
if n > k:
    for i in range(k):
        cost += x

    for j in range(k, n):
        cost += y
    print(cost)

elif n <= k:
    for i in range(n):
        cost += x
    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)
elif n <= k:
  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+1<=k):
        ans += x
    if(i+1>k):
        ans += y
print(ans)

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

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

Solution (Python):




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

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

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

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

x_days = min(n, k)
y_days = n - x_days

print(x * x_days + y * y_days)

Solution (Python):
stay = int(input())
days = int(input())
charge1 = int(input())
charge2 = int(input())
charge_total = 0

for i in range(stay):
    temp = i + 1
    if temp <= days:
        charge_total += charge1
    else:
        charge_total += charge2
print(charge_total)

Solution (Python):
n,k,x,y=[int(input())for i in [0]*4]
ans=0
ans+=min(k,n)*x
n-=min(k,n)
print(ans+y*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):












input_n = int(input())
input_k = int(input())
input_x = int(input())
input_y = int(input())


result = 0

for i in range(input_n):
    if i < input_k:
        result += input_x
    else:
        result += input_y

print(result)

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

Solution (Python):

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


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

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

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

print(sum_num)

Solution (Python):



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

result = 0

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

print(result)

Solution (Python):

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


S = int()

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

total = (K * X) + (N - K) * Y
goukei = N * X

if N < K:
    print(goukei)
else:
    print(total)

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

n, k, x, y = S_list
if n>=k:
    result = k*x +(n-k)*y    
else:
    result = n*x
print(result)

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

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

print(a)

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

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

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

Solution (Python):

n = int(raw_input())
k = int(raw_input())
p = int(raw_input())
q = int(raw_input())
print p * min(k,n) + max(n - k,0) *q

Solution (Python):

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

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

print(a+b)

Solution (Python):

total_days = int(input())
days_normal_price = int(input())
normal_price = int(input())
discount_price = int(input())


if total_days <= days_normal_price:
    answer =total_days * normal_price
    print(answer)
elif total_days > days_normal_price:
    first = normal_price * days_normal_price
    second = (total_days - days_normal_price) * discount_price
    answer = first + second
    print(answer)

Solution (Python):


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

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

print(hotel_fee)

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

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

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

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

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

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

Solution (Python):




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


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

Solution (Python):
num = int(input())
border = int(input())
first = int(input())
second = int(input())

if num <= border:
    price = num*first
else:
    price = border*first
    price += (num - border)*second
    
print(price)

Solution (Python):


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

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

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

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

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

total_payment = 0

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

print(total_payment)

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

total_payment = 0

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

print(total_payment)

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)
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(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):
total_stay = int(input())
normal_stay = int(input())
normal_cost = int(input())
discounted_cost = int(input())
if total_stay <= normal_stay:
  total_cost = total_stay * normal_cost
else:
  total_cost = normal_stay * normal_cost + (total_stay - normal_stay) * discounted_cost
print(total_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):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
sum=0
for i in range(a):
    if i<=b-1:
        sum+=c
    else:
        sum+=d
print(sum)

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

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

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

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

else:
    total_price = N * X

print(total_price)

Solution (Python):










N = int(input())

K = int(input())

X = int(input())

Y = int(input())




first_charge = K * X




second_charge = (N - K) * Y




if K >= N:
    answer = N * X
else:
    answer = first_charge + second_charge


print(answer)

Solution (Python):










N = int(input())

K = int(input())

X = int(input())

Y = int(input())




first_charge = K * X




second_charge = (N - K) * Y




if K >= N:
    answer = N * X
else:
    answer = first_charge + second_charge


print(answer)

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

Solution (Python):

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

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

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

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

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
n = I()
k = I()
x = I()
y = I()
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):


days_of_stay = int(input())
days_of_original_price = int(input())
original_price = int(input())
discount_price = int(input())



if days_of_stay <= days_of_original_price:
    total_fee = days_of_stay * original_price
    print(total_fee)
elif days_of_stay > days_of_original_price:
    total_fee = original_price * days_of_original_price + (days_of_stay - days_of_original_price) * discount_price
    print(total_fee)

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:
    K=N

KEI = K*X +(N-K)*Y
print(KEI)

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

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

Solution (Python):

def main():
	n = int(input())
	k = int(input())
	x = int(input())
	y = int(input())
	if n<=k:
		print(n*x)
	else:
		ans = 0
		ans = ans+k*x
		n = n-k
		ans = ans+n*y
		print(ans)
if __name__=="__main__":
	main()

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

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

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

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

print(ans)

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

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

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

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

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

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

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