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

Submission status: Accepted

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

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円、N(泊数)がK泊より多ければその分だけ一泊Y円
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
# K泊より多い場合はその分だけ単価Y円を掛ける
if N >= K:
    total_price = K * X + (N - K) * Y
# K泊より少ない場合は泊数に単価X円を掛ける
else:
    total_price = N * X

print(total_price)

Submission status: Accepted

Solution code:
# A - 高橋君とホテルイージー

# 1  軒のホテルがあります。 このホテルの宿泊費は、次のようになっています。

# 最初の K 泊までは、1 泊あたり X 円
# K+1 泊目以降は、1 泊あたり Y 円

# このホテルに N 泊連続で宿泊する と 宿泊費は合計で何円になるか

# N 宿泊数　を標準入力から得る
N = int(input())
# K 最初の拍数　を標準入力から得る
K = int(input())
# X K日間の料金  を標準入力から得る
X = int(input())
# Y K+1~Nまでの料金 を標準入力から得る
Y = int(input())
# print(N, K, X, Y)

# K 泊までの料金を計算
# K * X
first_charge = K * X
# print(first_charge)

# K + 1 ~ N までの料金を計算
# (N - K) * Y
second_charge = (N - K) * Y
# print(second_charge)

# 合算
# K >= N の場合は、N * X 円
if K >= N:
    answer = N * X
else:
    answer = first_charge + second_charge

# 結果を出力
print(answer)

Submission status: Accepted

Solution code:
# A - 高橋君とホテルイージー

# 1  軒のホテルがあります。 このホテルの宿泊費は、次のようになっています。

# 最初の K 泊までは、1 泊あたり X 円
# K+1 泊目以降は、1 泊あたり Y 円

# このホテルに N 泊連続で宿泊する と 宿泊費は合計で何円になるか

# N 宿泊数　を標準入力から得る
N = int(input())
# K 最初の拍数　を標準入力から得る
K = int(input())
# X K日間の料金  を標準入力から得る
X = int(input())
# Y K+1~Nまでの料金 を標準入力から得る
Y = int(input())
# print(N, K, X, Y)

# K 泊までの料金を計算
# K * X
first_charge = K * X
# print(first_charge)

# K + 1 ~ N までの料金を計算
# (N - K) * Y
second_charge = (N - K) * Y
# print(second_charge)

# 合算
# K > N の場合は、N * X 円
if K >= N:
    answer = N * X
else:
    answer = first_charge + second_charge

# 結果を出力
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
n = I()
k = I()
x = I()
y = I()
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:
    print(N * X)
else:
    print(K * X + (N - K) * Y)

Submission status: Accepted

Solution code:
# 宿泊代の合計金額を求める。

days_of_stay = int(input())
days_of_original_price = int(input())
original_price = int(input())
discount_price = int(input())


# if文の上が、割引適用なし。下が割引適用。
if days_of_stay <= days_of_original_price:
    total_fee = days_of_stay * original_price
    print(total_fee)
elif days_of_stay > days_of_original_price:
    total_fee = original_price * days_of_original_price + (days_of_stay - days_of_original_price) * discount_price
    print(total_fee)

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 K>N:
    K=N

KEI = K*X +(N-K)*Y
print(KEI)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

def main():
	n = int(input())
	k = int(input())
	x = int(input())
	y = int(input())
	if n<=k:
		print(n*x)
	else:
		ans = 0
		ans = ans+k*x
		n = n-k
		ans = ans+n*y
		print(ans)
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, K, X, Y = [int(input()) for _ in range(4)]
m = min(N, K)
print(X * m + Y * (N - m))

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

print(X * min(K, N) + 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(n*x)
else:
  print((k*x)+((n-k)*y))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# A - 高橋君とホテルイージー
def main():
    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())
    cost = 0

    for i in range(1, n+1):
        if i <= k:
            cost += x
        else:
            cost += y
    else:
        print(cost)
        
    
if __name__ ==  "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    K = int(readline())
    X = int(readline())
    Y = int(readline())
    if N <= K:
        ans = X * N
    else:
        ans = X * K + Y * (N - K)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

xdays = min(n,k)
ydays = n-xdays

ans = xdays*x + ydays*y
print(ans)

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

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

Submission status: Accepted

Solution code:
N= [int(input()) for n 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:
    ans = N * X
else:
    ans = K * X + (N - K) * Y
print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

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


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

sale=0

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

print(sale)

Submission status: Accepted

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

total = 0
day = 0
for i in range(n):
    day += 1
    if day <= 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:
  s=x*K+y*(N-K)
else:
  s=x*N
print(int(s))

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:
list = []
price = 0

for i in range(4):
    list.append(int(input()))

for i in range(list[0]):
    if i < list[1]:
        price += list[2]
    else:
        price += list[3]

print(price)

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

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

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

temp = n - k

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

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

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

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

Submission status: Accepted

Solution code:
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
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
import numpy as np
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

def INT(): return int(input())
N = INT()
K = INT()
X = INT()
Y = INT()

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

Submission status: Accepted

Solution code:
n_stay = int(input())
n_p1 = int(input())
p1 = int(input())
p2 = int(input())

print(min([n_p1, n_stay]) * p1 + max([n_stay - n_p1, 0]) * p2)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

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:
import sys
def I(): return int(sys.stdin.readline().rstrip())

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

Submission status: Accepted

Solution code:
total_nights = int(input())
first_nights = int(input())
first_rate = int(input())
extra_rate = int(input())

if total_nights <= first_nights:
  total = total_nights * first_rate
else:
  total = (first_nights * first_rate) + ((total_nights - first_nights) * extra_rate)
print(total)

Submission status: Accepted

Solution code:
num1 = int(input())
num2 = int(input())
num3 = int(input())
num4 = int(input())

if num1>num2:
  print(num2*num3+(num1-num2)*num4)
else:
  print(num1*num3)

Submission status: Accepted

Solution code:
def main():
    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__":
    main()

Submission status: Accepted

Solution code:
s = []
for _ in range(4):
    s.append(int(input()))
p=0
for i in range(s[0]):
    if i<s[1]:
        p+=s[2]
    else:
        p+=s[3]
print(p)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())
    cost = 0
    
    if n <= k:
        cost += n * x
    elif n > k:
        cost += k * x + (n - k) * y
    print(cost)
    
  
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, k, x, y = (int(input()) for i in range(4))
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())
bill = 0
for i in range(1,n+1):
    if i <= k:
        bill += x
    if i > k:
        bill +=y
print(bill)

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

Submission status: Accepted

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

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 heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

ans = min(N, K) * X

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N, K, X, Y = (int(input()) for _ in range(4))
    to_pay = X * min(K, N) + Y * max(0, N - K)
    print(to_pay)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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:
import sys
n,k,x,y = map(int,sys.stdin.read().split())
high=n-k
ans=0
if high > 0:
  ans=x*k+high*y
else:
  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:
    ans=x*n
else:
    ans=x*k+(n-k)*y
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K,X,Y = map(int, open(0).read().split())
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))
if k < n:
    print(k*x + 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:
  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:
    ans = X*N
else:
    ans = X*K
    ans += Y*(N-K)
print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

n = ini()
k = ini()
x = ini()
y = ini()


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

    return ans


print(solve())

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

    print(ans)

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
import sys
input = sys.stdin.readline

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

ans = 0

for i in range(1,N+1):
    ans += X

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# template: v1.2

import io
import sys
import math

def solve(n,k,x,y):
    # implement process
    higher = n-k
    if higher < 1:
        return n*x
    else:
        return k*x + higher*y



def main():
    # input
    n,k,x,y = map(int,sys.stdin.read().split())
    
    # process
    ans = str( solve(n,k,x,y) )
    
    # output
    print(ans)
    return ans
        
### DEBUG I/O ###
_DEB = 0   # 1:ON / 0:OFF

_INPUT = """\
2
3
10000
9000
"""
_EXPECTED = """\
20000
"""

def logd(str):
    if _DEB: print(f"[deb] {str}")

### MAIN ###
if __name__ == "__main__":
    if _DEB:
        sys.stdin = io.StringIO(_INPUT)
        print("!! Debug Mode !!")

    ans = main()

    if _DEB:
        print()
        if _EXPECTED.strip() == ans.strip(): print("!! Success !!")
        else: print(f"!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")

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

resolve()

Submission status: Accepted

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

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

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

print(a)

Submission status: Accepted

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

ans = []
if n>k:
    for i in range(k):
        ans.append(x)

    for i in range(n-k):
        ans.append(y)
else:
    for i in range(n):
        ans.append(x)
print(sum(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 (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 if n <= k else 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:
    result= (K * X )+ Y * (N-K)
else:
   result= N*X
print("% d"%result)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n, k, x, y = [int(input()) for _ in range(4)]
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())
if n<=k:
  ans=n*x
else:
  ans=k*x+y*(n-k)
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:
total = int(input())
until = int(input())
fee1 = int(input())
fee2 = int(input())

if total - until > 0:
    diff = total - until
    print(until * fee1 + diff * fee2)
else:
    print(total * fee1)

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())
print(min(k,n)*int(input())+max(0,n-k)*int(input()))