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



Sample input:
5
3
10000
9000


Sample output:
48000

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
# Vicfred
# https://atcoder.jp/contests/abc044/tasks/abc044_a
# simulation
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

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


#############
# Constants #
#############

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

#############
# Functions #
#############

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

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

######Combination######
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

######Factorization######
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

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

#############
# Main Code #
#############

N,K,X,Y = inputILs(4)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)
# a = list(a)
# has = {}
# x,y = -1,-1
# for i in range(len(a)):
#     has[a[i]]=[0,0]

# for i in range(len(a)):
#     has[a[i]][0] += 1
#     if has[a[i]][0]==1:
#         has[a[i]][1] = i
#     temp1 = has[a[i]][0]
#     # print(temp1)
#     if i>2 and temp1>2:
#         temp = has[a[i]][1]
#         if temp1>(i-temp)//2:
#             x,y = temp+1,i+1
#             break
# print(x,y)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

inputs = [int(input()) for i in range(4)]

use_num = inputs[0]
sell_start_num = inputs[1]
basic_price = inputs[2]
sell_price = inputs[3]
price_sum = 0

for i in range(use_num):
    if i >= sell_start_num:
        price_sum += sell_price
    else:
        price_sum += basic_price

print(price_sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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)

Submission status: Accepted

Solution code:
#高橋君とホテルイージー
def ABC_44_A():
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())

    syukuhakuhi = 0

    for i in range(N+1):

        if i!=0:
            if i <= K:
                syukuhakuhi+=X
            else:
                syukuhakuhi+=Y
    print(syukuhakuhi)


if __name__ == '__main__':

    ABC_44_A()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = [int(input()) for i in range(4)]
#s[0]=N,s[1]=K,s[2]=X,s[3]=Y
if s[0] < s[1]:
    print(s[0] * s[2])
else:
    print(s[1] * s[2] + (s[0] - s[1]) * s[3])

Submission status: Accepted

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

Submission status: Accepted

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

if n < k:
    ans = n * x
    print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

o = n - k

sum = 0
if o > 0:
    sum += k * x
    sum += o * y
    print(sum)
    exit()
else:
    sum += n * x
    print(sum)

Submission status: Accepted

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

o = n - k

sum = 0
if o > 0:
    sum += k * x
    sum += o * y
else:
    sum += n * x

print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K,X,Y=map(int,open(0));print(N*X if N<=K else K*X+(N-K)*Y)

Submission status: Accepted

Solution code:
N,K,X,Y=map(int, open(0).read().split());print(N*X if N<=K else K*X+(N-K)*Y)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

def resolve():
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())
    xdays = min(N, K)
    ydays = max(N-K, 0)
    print(X*xdays+Y*ydays)
    
    


if '__main__' == __name__:
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

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

sum=0

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

if n<k:
    sum=n*x

print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
k=max([0,n-int(input())])
print(int(input())*(n-k)+int(input())*k)

Submission status: Accepted

Solution code:
n=int(input())
k=max([0,n-int(input())])
x=int(input())
y=int(input())
print(x*(n-k)+y*k)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

P=N-K

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
stay = int(input())
change_day = int(input())
first_cost = int(input())
change_cost = int(input())
total_cost = 0
 
for i in range(stay):
 if(i < change_day):
  total_cost += first_cost
 else:
  total_cost += change_cost
print(total_cost)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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