Problem:
 Score : 100 points    Problem Statement There is a hotel with the following accommodation fee:   X yen (the currency of Japan) per night, for the first K nights  Y yen per night, for the (K+1) -th and subsequent nights   Tak is staying at this hotel for N consecutive nights.
Find his total accommodation fee.      Constraints  1 \leq N, K \leq 10000  1 \leq Y < X \leq 10000  N,\,K,\,X,\,Y are integers.         Input The input is given from Standard Input in the following format:  N  K  X  Y       Output Print Tak's total accommodation fee.        Sample Input 1 5
3
10000
9000      Sample Output 1 48000  The accommodation fee is as follows:   10000 yen for the 1 -st night  10000 yen for the 2 -nd night  10000 yen for the 3 -rd night  9000 yen for the 4 -th night  9000 yen for the 5 -th night   Thus, the total is 48000 yen.       Sample Input 2 2
3
10000
9000      Sample Output 2 20000

Solution (Python):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
 
if N <= K :
	answer = X * N
elif N >= K + 1:
	answer = (X * K) + (Y * (N - K) )
print(answer)

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

Solution (Python):
import sys

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

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

if __name__ ==  '__main__':
    main()

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

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

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

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

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

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

Solution (Python):

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

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

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

print(fee)

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

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

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

total = 0

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

print(total)

Solution (Python):
N,K,X,Y=map(int,open(0));print(N*X-max(0,(N-K)*(X-Y)))

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

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

Solution (Python):
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())
    a1=0
    a2=0
    if n<=k:
        a1=n
    else:
        a1=k
        a2=n-k


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

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

Solution (Python):
"""
in1 = '5'
in2 = '3'
in3 = '10000'
in4 = '9000' 
in1 = '2'
in2 = '3'
in3 = '10000'
in4 = '9000' 
"""
in1 = input()
in2 = input()
in3 = input()
in4 = input()

N = int(in1)
K = int(in2)
X = int(in3)
Y = int(in4)
RC = 0

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

print(RC)

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


from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt, floor, ceil, log2
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key



__MOD__=(10**9)+7
yn = 'YNeos'
judge = False
cnt = 0
ans = None


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

def intinput():
    return int(input())

def mulinputs():
    return map(int,input().split())

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas

class ModInt():
    def __init__(self, x):
        self.__x = (x % __MOD__)
    def __add__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x + other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x + other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __sub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x - other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x - other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __mul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __truediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __pow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(self.__x, other.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(self.__x, other.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")
    def __modinv(self, m=__MOD__):
        a = self.__x
        if a == 0:
            raise ZeroDivisionError()
        if gcd(a, m) != 1:
            raise Exception("%sの逆数は求まりません。" % a)
        b, u, v = m, 1, 0
        while b != 0:
            t = a//b;
            a -= t*b
            a, b = b, a
            u -= t * v
            u, v = v, u
        u %= m
        if u < 0:
            u += m
        return u
    def __int__(self):
        return self.__x



if __name__ == '__main__':
    N = intinput()
    K = intinput()
    X = intinput()
    Y = intinput()

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

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(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:
  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),0)*y)

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

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

ans = 0
for i in range(1,n+1):
    
    if i > k:
        ans += y
        continue
    ans += x
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):
def problemA():
    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)


if __name__ == '__main__':
    problemA()

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

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

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

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 = 0
for i in range(1, n+1):
    if i > k:
        ans += y
        continue
    ans += x
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=int(input())
K=int(input())
X=int(input())
Y=int(input())

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

Solution (Python):
n= int(input())
n2= int(input())
n3= int(input())
n4= int(input()) 

if n <= n2:
    one = n*n3
    print(one)
else:
    one = n2*n3
    two = (n-n2)*n4
    print(one + two)

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

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    K=I()
    X=I()
    Y=I()
    if N<=K:
        print(N*X)
    else:
        print(K*X+(N-K)*Y)

main()

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

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

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

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

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

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

if A[0] >= A[1]:
    ans = A[1] * A[2] + (A[0] - A[1]) * A[3]
else:
    ans = A[0] * A[2]

print(ans)

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

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

Solution (Python):

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

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

Solution (Python):

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

Solution (Python):
import sys
import itertools
readline = sys.stdin.buffer.readline

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

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

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

print(p)

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

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

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

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

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

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

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



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

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

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

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

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

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

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

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

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

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

print(fee)

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

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

print(sum)

Solution (Python):
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    n,k,x,y = (int(sys.stdin.readline().rstrip()) for i in range(4))

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


if __name__ == '__main__':
    main()

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

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

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

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

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

print (total)

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

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

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

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

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

ans = 0

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

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

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

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

import sys
sys.setrecursionlimit(10**8)
INF = float("inf")


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

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

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

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

fee = 0
day = 1
if N < K:
    fee = N*X
else:
    while day <= K:
        fee += X
        day += 1
    while K < day <= N:
        fee += Y
        day += 1
    

print(fee)

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

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

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

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

Solution (Python):

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

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

Solution (Python):

N=int(input())
K=int(input())
X=int(input())
Y=int(input())
sum=0
N_count=N
K_count=K

while( (N_count>0) & (K_count>0) ):
    N_count-=1
    K_count-=1
    sum+=X
while( (N_count>0) & (K_count==0) ):
    N_count-=1
    sum+=Y
print(sum)

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 range(4))
result = 0
for _ in range(n):
    if _ < k:
        result += x
    elif _ >= k:
        result += y
print(result)

Solution (Python):

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

Solution (Python):
def main():
    staying_days, first_night, first_cost, latter_cost = [int(input()) for _ in range(4)]
    print(min(staying_days, first_night) * first_cost + max(0, staying_days - first_night) * latter_cost)


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

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

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

Solution (Python):



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


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

print(ans)

Solution (Python):
def syukuhakuhi(n, k, x, y):
    sum = 0
    for i in range(n):
        if (i + 1) <= k:
            sum += x
        else:
            sum += y
    return sum


string_list = [input() for i in range(4)]

n = int(string_list[0])
k = int(string_list[1])
x = int(string_list[2])
y = int(string_list[3])

answer = syukuhakuhi(n, k, x, y)
print(answer)

Solution (Python):


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

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

Solution (Python):

 
 
def main():
 
    n_haku = int(input())
    k_haku = int(input())
    x_yen = int(input())
    y_yen = int(input())
    
    if n_haku <= k_haku:
        ryokin = x_yen * n_haku
    else:
        ryokin = x_yen * k_haku + y_yen * (n_haku - k_haku)

    print(ryokin)    
    
    return 0
 
 
if __name__ == '__main__':
    main()

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

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

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

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

print(price)

Solution (Python):

import sys


def solve(N: int, K: int, X: int, Y: int):
    print(X * min(N, K) + Y * max(0, N - K))


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 = 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 os

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

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

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

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

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

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 i in range(4)]
if n > k:
    syogaku = k * x
    sagaku = (n - k) * y
    print(syogaku + sagaku)
else:
    syogaku = n * x
    print(syogaku)

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

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

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

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

Solution (Python):
N,K,X,Y=map(int,open(0).read().split())
print(min(N,K)*X+max(0,N-K)*Y)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

print(val)

Solution (Python):
import numpy as np
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())


def totalPrice(N, K, X, Y):
    total = 0
    for i in range(1, N + 1):
        if i <= K:
            total += X
        else:
            total += Y
    return total

print(totalPrice(N, K, X, 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)