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

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

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

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

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

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

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

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

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

Solution (Python):

days = int(input())
k = int(input())
fee1 = int(input())
fee2 = int(input())


if days <= k :
    all_fee = days * fee1
else :
    all_fee = k * fee1 + (days - k) * fee2


print(all_fee)

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

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

print(total)

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:
  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:
    print(b*c+(a-b)*d)
else:
    print(a*c)

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

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

Solution (Python):
N,K,X,Y=[int(input()) for i in range(4)]
print(N*X if N<=K else 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):
want = int(input())
due = int(input())
start = int(input())
over = int(input())
e = want - due
yen = 0
if e <= 0:
    for i in range(want):
        yen += start

if e > 0:
    for i in range(due):
        yen += start
    for j in range(e):
        yen += over
print(yen)

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

Solution (Python):
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys
import itertools

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K, X, Y = map(int, read().split())

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

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

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

print(ryoukin)

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

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




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

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

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

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

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

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

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

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

sum = 0

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

print(sum)

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

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

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

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

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

Solution (Python):
n = int(input().split()[0])
k = int(input().split()[0])
x = int(input().split()[0])
y = int(input().split()[0])

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

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
print(sum([X if K>=j else Y for j in range(1, N+1)]))

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

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

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

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

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

Solution (Python):
def is_over_threshold_days(stay_days, threshold_days):

    if stay_days <= threshold_days:
        return False
    if stay_days > threshold_days:
        return True

def calc_accomodation_fee(stay_days, threshold_days, 
                                first_fee, second_fee):

    if is_over_threshold_days(stay_days, threshold_days):
        sum_of_first_fee = first_fee * threshold_days
        sum_of_second_fee = second_fee * (stay_days - threshold_days)
        return sum_of_first_fee + sum_of_second_fee
    else:
        return stay_days * first_fee

if __name__=='__main__':
    stay_days, threshold_days, first_fee, second_fee = [int(input()) for i in range(4)]
    print(calc_accomodation_fee(stay_days, threshold_days, first_fee, second_fee))

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

Solution (Python):

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

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

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

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

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

print(A)

Solution (Python):
import sys


n = int(input())


k = int(input())


x = int(input())


y = int(input())


if n > k:
    day_x = k
    day_y = n - k
else:
    day_x = n
    day_y = 0
    
print(x * day_x + y * day_y)

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

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

Solution (Python):
def main():
    from sys import stdin, setrecursionlimit
    
    
    
    
    
    t = [int(stdin.readline()) for i in range(4)]
    
    
    
    
    
    
    
    res = 0
    for i in range(t[0]):
        if i < t[1]:
            res += t[2]
        else:
            res += t[3]

    print(res)

if __name__ == '__main__':
    main()

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

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

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):
if __name__ == "__main__":
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())
    sum = 0
    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())

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

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

total = 0
if N-K < 0:
    for _ in range(N):
        total += X
else:
    for _ in range(K):
        total += X

    for _ in range(N-K):
        total += Y

print(total)

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

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

print(count)

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

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

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

sum = 0

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

print(sum)

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 _ in range(4)]

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

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


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

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

Solution (Python):
import sys

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

print(sum)

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

print(total_cost)

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

if l[0]<=l[1]:
    print(l[0]*l[2])
else:
    print(l[1]*l[2]+(l[0]-l[1])*l[3])

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

if l[0]<=l[1]:
    print(l[0]*l[2])
else:
    print(l[1]*l[2]+(l[0]-l[1])*l[3])

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

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

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

if n < k:
    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())

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

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

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

total = 0

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

print(total)

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

if a[0] < a[1]:
	print(a[0] * a[2])
else:
	print(int(a[1]) * int(a[2]) + (int(a[0]) - int(a[1])) * int(a[3]))

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

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

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

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

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

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

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

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

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

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

ac_fee = 0

if (N - K) > 0:
    for i in range(1, K+1):
        ac_fee += X
    for j in range(K+1, N+1):
        ac_fee += Y
else:
    for k in range(1, N+1):
        ac_fee += X
    
print(ac_fee)

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

result = n*x

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

print (result)

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

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

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

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if K >= N:
    print(X * N)
else:
    print(X * K + (N - K) * Y)

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

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

Solution (Python):

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

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

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

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

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

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

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

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

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

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

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

print(k * x + (n - k) * y)

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

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

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

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

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

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

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

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

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

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

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

print(total)

Solution (Python):
import math
import fractions

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

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

print(ans)

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

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

    
print(answer)

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

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

ryokin=0

if n <= k :
    ryokin = n*x

else:
    ryokin = k*x + (n-k)*y

print(ryokin)

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

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

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

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

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

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

Solution (Python):

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

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

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

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

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

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 main(argv=sys.argv):

    actual_stay = int(input())

    init_stay = int(input())

    init_charge = int(input())

    extra_charge = int(input())

    total_charge = 0

    if actual_stay > init_stay:

        total_charge = init_stay * init_charge + \
                       (actual_stay - init_stay) * extra_charge

    else:

        total_charge = actual_stay * init_charge

    print(total_charge)

    return 0


if __name__ == '__main__':
    sys.exit(main())

Solution (Python):

import sys

def main(argv=sys.argv):
  
  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)
  
  
  return 0

if __name__ =='__main__':
  sys.exit(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())
a = k * x
b = (n - k) * y
if n > k:
    print(a + b)
else:
    print(n * x)

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

X_days = min(N, K)
Y_days = N - X_days
ans = X*X_days + Y*Y_days
print(ans)

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

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

Solution (Python):
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def gcd(a,b): 
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def divisors(a): 
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): 
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): 
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def main():
    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())
    ans = 0
    if n>=k:
        ans = x * k + y * (n - k)
    else:
        ans = x * n
    print(ans)
    return

if __name__=='__main__':
    main()

Solution (Python):
lst = list(int(input()) for _ in range(4))

print(lst[0]*lst[2] if lst[0]<=lst[1] else lst[1]*lst[2]+lst[3]*(lst[0]-lst[1]))

Solution (Python):
import math

n, k, x, y = [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())

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

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

Solution (Python):
import sys

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

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

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

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

total = 0

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

else :
  total = int(n * x)

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

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

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

Solution (Python):


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

a = abs(n - k)

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

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

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

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

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