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

import sys
import math


def get_ints(): return map(int, input().strip().split())
def get_list(): return list(get_ints())

def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")
def printchk(*args): return print(*args, end=" \ ")

MODPRIME = int(1e9+7); BABYMODPR = 998244353;

ONLINE_JUDGE = 1
if not ONLINE_JUDGE:
    sys.stdin  = open("input.txt","r")
    sys.stdout = open("output.txt","w")
    sys.stderr = open("output.txt","w")


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

'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS BY ME @luctivud ( UDIT GUPTA )
SOME PARTS OF THE CODE HAS BEEN TAKEN FROM WEBSITES LIKE::
(I Own the code if no link is provided here or I may have missed mentioning it)
DO NOT PLAGIARISE.
TESTCASES:
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

Solution (Python):
import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache

sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007

def main():
	n = I()
	k = I()
	x = I()
	y = I()

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

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

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

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

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

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

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


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

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


if __name__ == '__main__':
    resolve()

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(x*n-max((x-y)*(n-k),0))

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

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

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

def goukei(N,K,X,Y):
    money = 0
    if N > K:
        for i in range(K):
            money += X
    else:
        for i in range(N):
            money += X
    if N - K > 0:
        for j in range(N-K):
            money += Y
    return money

print(goukei(N,K,X,Y))

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

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

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

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

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

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

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

Solution (Python):
ns=[]

for i in range(4):
  ns.append(input())

n=[]

for j in range(4):
  n.append(int(ns[j]))

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

Solution (Python):
import sys

lis = list()

for line in sys.stdin : 
  lis.append(int(line))
  

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

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

Solution (Python):

import sys


def solve(N: int, K: int, X: int, Y: int):
    res = 0
    if N > K:
        res = K * X + (N - K) * Y
    else:
        res = N * X
    print(int(res))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    X = int(next(tokens))  
    Y = int(next(tokens))  
    solve(N, K, X, Y)


if __name__ == "__main__":
    main()

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

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

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

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

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

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

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

f_normal = x * n
f_addition = x * k  + y * (n - k)

if n <= k:
  print(f_normal)
else:
  print(f_addition)

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

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

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

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

print(c)

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

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

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

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

Solution (Python):
hotel=int(input())
hotel2=int(input())
hotel3=int(input())
hotel4=int(input())

if hotel > hotel2:
	sum1=int(hotel2)*int(hotel3)
	hotel5=int(hotel)-int(hotel2)
	sum2=int(hotel5)*int(hotel4)
	fee=int(sum1)+int(sum2)
else:
  fee=int(hotel)*int(hotel3)
 
print(str(fee))

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

K = input()

X = input()

Y = input()

S = 1

P = 0


if int(N) >= int(K):
    
    while S <= int(K):
        P = P + int(X)
        S = S + 1

    
    while S <= int(N):
        P = P + int(Y)
        S = S + 1

else :
    
    while S <= int(N):
        P = P + int(X)
        S = S + 1


print(P)

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

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

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


if N < K:
    sum_a = X * N
    sum_b = 0
else:
    sum_a = X * K
    sum_b = Y * (N-K)

print(sum_a + sum_b)

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

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 = int(input())
K = int(input())
X = int(input())
Y = int(input())
c = 0
for i in range(1,N+1):
    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):
    hotel_sum=N*X
else:
    hotel_sum=K*X+(N-K)*Y
print(hotel_sum)

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

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

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

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

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

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

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

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

Solution (Python):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
a = 0
b = 0
c = 0
e = 0

if n <= k:
    a = n * x
else:
    c = n - k
    a = x * k
    b = c * y

e = a + b
print(e)

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

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

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

cost = 0
if 1 <= n <= 10000 and 1 <= k <= 10000 and 1 <= y < x <= 10000:
  if n > k:
    cost += x * k
    cost += y * (n - k)
  elif n <= k:
    cost += n * x
  
print(cost)

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

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

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

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

Solution (Python):
N = int(input())
K = int(input())
price = int(input())
d_price = int(input())
if K >= N:
    total = N * price
    print(total)
else:
    total = K * price
    N -= K
    total += N * d_price
    print(total)

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

Solution (Python):

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

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

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

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

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+1:
        price += x
    else:
        price += y

print(price)

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

Solution (Python):

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

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

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

if n >= k:
    nd = n - k
    total = x*k + y*nd
else:
    total = n*x

print(total)

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

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

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

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

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

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

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

print(ans)

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

Solution (Python):



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

total = 0

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

print(total)

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

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

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    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__':
    main()

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):
times, first, first_amount, second_amount = [int(input()) for i in range(4)]
total = 0
for i in range(times):
    if first > 0:
        total += first_amount
        first -= 1
    else:
        total += second_amount
print(total)

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

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()

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

temp = min([n,k]) * x
if k<n:
    temp += (n-k) * y
print(temp)

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

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

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

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

Solution (Python):


import sys






















def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n, k, x, y = [ii() for _ in range(4)]
    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())

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

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
x = 0
for i in range(a):
    if b > 0:
        x = x + c
        b = b - 1
    else:
        x = x + d
print(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):
def main():
    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())

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


if __name__ == '__main__':
    main()

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

else:
    print(n*x)

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

print(m)

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

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

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

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

Solution (Python):
def main():
 num =  [int(input()) for i in range(4)]
 price=0
 for i in range(0,num[0]):
  if i< num[1] :
   price+=num[2]
  else:
   price+=num[3]
 print(price)

main()

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

Solution (Python):
from sys import stdin

def S(): return stdin.readline().rstrip()
def I(): return int(stdin.readline().rstrip())
def LS(): return list(stdin.readline().rstrip().split())
def LI(): return list(map(int,stdin.readline().rstrip().split()))

n,k,x,y=[I() for i in range(4)]

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

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

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

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






import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr


def lcm(a, b):
    return a * b // gcd (a, b)





N,K,X,Y = inputILs(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(x * min(n, k)+ y * max(0, 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 k > 0 :
		k -= 1
		ans += x
	elif k == 0 :
		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):
def cin():
	return map(int,input().split())

def cino(test=False):
    if not test:
        return int(input())
    else:
        return input()
def cina():
  return list(map(int,input().split()))

a = cino()
b = cino()
c = cino()
d = cino()

ans = min(a,b)*c + (a-min(a,b))*d
print(ans)

Solution (Python):
import sys
import math
import bisect
 
def main():
    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)
 
if __name__ == "__main__":
    main()

Solution (Python):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9+7

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

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

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

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

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
N = INT()
K = INT()
X = INT()
Y = INT()

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

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

print(total)

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

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

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

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

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

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

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

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

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

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

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

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