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

Submission status: Accepted

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

# k泊
if (n < k):
    price = n * x
else:
    price = k * x
    # after k+1 
    price += (n-k) * y

print(price)

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 = 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,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 range(4)]

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

Submission status: Accepted

Solution code:
l=[int(input()) for i in range(4)]
print(l[0]*l[2]-max(l[0]-l[1],0)*(l[2]-l[3]))

Submission status: Accepted

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

Submission status: Accepted

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

price = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
K=int(input())
S=int(input())
T=int(input())

if N<=K:
  sum=N*S
else:
  sum=K*S
  if N-K>0:
    sum+=(N-K)*T
print(sum)

Submission status: Accepted

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

Submission status: Accepted

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



print(pay)

Submission status: Accepted

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

first = min(n, k) * x
second = max(n-k, 0) * y

print(first + second)

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

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

#計算
if N <= K:
   result = X * N
else:
   result = (X * K) + (Y * (N - K))

#出力
print(result)

Submission status: Accepted

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

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, 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:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = 0

for i in range(1,a+1):
  if i >= b+1:
    e += d
  else:
    e += c
print(e)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations

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

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

Submission status: Accepted

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

ans = 0
for i in range(N):
  if i+1 <= 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:
i=input
N,K,X,Y = map(int,[i(),i(),i(),i()])
print(sum([X if i<K else Y for i in range(N)]))

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

#print("{} {} {} {}".format(N, K, X, Y))

res = 0

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

print(res)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10**9)
mod = 10**9+7

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def actual(N, K, X, Y):
    if N <= K:
        return X * N

    return (X * K) + (Y * (N - K))

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

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

Submission status: Accepted

Solution code:
n = 4
total = int(0)
zenhan = int(0)
kouhan = int(0)

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

kouhan = (N - K ) * Y

if (N > K):
    zenhan = K * X
    total = zenhan + kouhan
else:
    zenhan = N * X
    total = zenhan

print(total)

Submission status: Accepted

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

# ケアレスミスしないように一旦紙に式を書くこと

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

diff = y - x

p_x = x * n
p_y = diff * (n - k) if (n - k) > 0 else 0

print(p_x + p_y)

#p_x = x * k if n - k >= 0 else x * n
#p_y = (n - k) * y if n - k > 0 else 0

#print(p_x + p_y)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def hotel():
    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())
    first = x * k
    later = y * (n - k)
    if k > n:
        first = x * n
        later = 0
    print(first + later)

hotel()

Submission status: Accepted

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

total = 0
if n <= k:
    total = n * x

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

print(total)

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:


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N = read_int()
    K = read_int()
    X = read_int()
    Y = read_int()
    if K >= N:
        return X*N
    cost = X*K
    N -= K
    cost += N*Y
    return cost


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

Submission status: Accepted

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
k = i()
x = i()
y = i()

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b,c,d=[int(input()) for i in range(4)]
print(c*min(a,b)+d*max(a-b,0))

Submission status: Accepted

Solution code:
info = [int(input()) for i in range(4)]

n = info[0]
k = info[1]
x = info[2]
y = info[3]

money = 0

for i in range(n):
    if i >= k:
        money += y
    else:
        money += x

print(money)

Submission status: Accepted

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

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

Submission status: Accepted

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

print(m)

Submission status: Accepted

Solution code:
'''     ##     ##  #######  # #  ######
        ##     ##  ##   ##  ###    ##
        ##     ##  ##    #  # #    ##
        #########  #######  # #    ##    '''

import sys
import math
# sys.setrecursionlimit(10**6)

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

# for _testcases_ in range(int(input())):
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 !!
'''

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N,K,X,Y = [int(input()) for i in range(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())
if N <= K:
  a=X*N
else:
  a=X*K+Y*(N-K)
print(a)

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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 n*x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#泊数
N = int(input())
#K+1泊以降
K = int(input())
#N泊に対する1泊当たりの料金
X = int(input())
#K+1泊に対する１泊当たりの料金
Y = int(input())
#宿泊費の合計
if(N<K):
    hotel_sum=N*X
else:
    hotel_sum=K*X+(N-K)*Y
print(hotel_sum)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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