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

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

Submission status: Accepted

Solution code:
n,k,x,y=map(int,open(0).read().split())
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())

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

Submission status: Accepted

Solution code:
# N泊したい
N = int(input())

# 最初のK泊までは、1泊あたりX円
# K+1泊以降では、1泊あたりY円
K = int(input())
X = int(input())
Y = int(input())

# 最初のK伯までの宿泊費を計算
# K泊以内の場合は、全部X円/泊で計算
first = min(K,N) * X

# K泊以降の宿泊費を計算
if N-K >0:
    # 超えた分だけY円/泊で計算
    after = (N-K) * Y
else:
    # K泊以内なら追加費用なし
    after = 0

# 答えを出力
print(first + after)

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

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
print(max(N - K, 0) * Y + min(K, 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(1, N+1):
    if i > K:
        ans += Y
    else:
        ans += X

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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

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

print(R)

Submission status: Accepted

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

if N > K:
    first_prize = K * X
    second_prize = (N - K) * Y
    total_prize = first_prize + second_prize
else:
    total_prize = N * X

print(total_prize)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K,X,Y=[int(input()) for i in range(4)]
print(N*X-(X-Y)*max(0,N-K))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
ans=0
for i in range(a):
    if 0<b:
        ans+=c
    else:
        ans+=d
    b=b-1
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((N - K) * Y + K * X)

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

total = 0

if K >= N:
    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())
ans = 0

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

Submission status: Accepted

Solution code:
stay_day = int(input())
first_stay_day = int(input())
first_stay_cost = int(input())
second_stay_cost = int(input())

if stay_day <= first_stay_day:
    cost = first_stay_cost * stay_day
elif stay_day > first_stay_day:
    cost = first_stay_cost * first_stay_day + second_stay_cost * (stay_day - first_stay_day)

print(cost)

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

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

Submission status: Accepted

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

S = N - K

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

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
k = int(stdin.readline().rstrip())
x = int(stdin.readline().rstrip())
y = int(stdin.readline().rstrip())

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

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

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

Submission status: Accepted

Solution code:
#N宿泊数
#K:料金X円の日数
#X:料金
#Y:割り増し料金
N=int(input()) #全宿泊日数
K=int(input()) #予定宿泊日数
X=int(input()) #基本料金
Y=int(input()) #割り増し料金
if N>K:
    S=K*X+(N-K)*Y
else: #早く帰るとき
    S=N*X
print(S)

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

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

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

Submission status: Accepted

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

if N <= K:
    print(N * X)
else:
    S = K * X #最初の宿泊金額
    p = N - K #残りの日数
    s = p * Y #残りの宿泊金額
    S += s #足す
    print(S)

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
# ABC044a
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

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:
    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())
cost = int()

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

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

Submission status: Accepted

Solution code:
N, K, X, Y = map(int, open(0).read().split())

before_fee = 0
after_fee = 0

if N >= K:
    before_fee = K * X
    if N > K:
        after_fee = (N-K) * Y
else: 
    before_fee = N * X

print(before_fee + after_fee)

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    *a,=map(int,open(0).read().split())
    print((min(a[:2])*a[2])+max(0,(a[0]-a[1]))*a[3])
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())

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

t = 0

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

Submission status: Accepted

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

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:
import math

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

Submission status: Accepted

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

Submission status: Accepted

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

print(k*x+y*nk)

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:
a=int(input())
b=int(input())
x=int(input())
y=int(input())

if a>b:
  print(b*x+(a-b)*y)
else:
  print(a*x)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
#ABC044_A

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, fractions
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

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

Submission status: Accepted

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

print(cost)

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 _ in range(4)]
print(n*x-max(0,n-k)*(x-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:
n = int(input())
k = int(input())
x = int(input())
y = int(input())
ans = 0
for i in range(n):
    if i+1>k:
        ans += y
    else:
        ans += 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 + (n-k)*y)
else:
  print(n*x)

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

print(answer)

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
def examA():
    N = I(); K = I(); X = I(); Y = I()
    sum = 0
    sum += min(N,K)*X
    sum += max(N-K,0)*Y
    ans = sum
    print(ans)
   
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()

Submission status: Accepted

Solution code:
# python3 (3.4.3)
import sys
input = sys.stdin.readline

# main
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:
# -*- coding: utf-8 -*-

# 整数の入力
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:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
 
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(x*n)
else:print(x*k+(n-k)*y)

Submission status: Accepted

Solution code:
data=[]
for i in range(4):
  data.append(int(input()))

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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*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(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())
s = 0
for n in range(1,N+1):
  if n <= K:
    s = s + X
  else:
    s = s + Y
print(s)

Submission status: Accepted

Solution code:
# A - 高橋君とホテルイージー / Tak and Hotels (ABC Edit)
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 K > N:
  price = N * X
else:
  price = K * X + (N-K)*Y
print(str(price))

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

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

cost = 0
for n in range(N):
    if n < K:
        cost += X
    else:
        cost += Y

print(cost)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
x = int(input())
y = int(input())
  
if k < n:
    a = k * x + (n - k) * y
else:
    a = n * x
print (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:
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:
# -*- coding: utf-8 -*-
# 整数の入力
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

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

print('%d' %(sum))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

result = 0

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

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# N, K = map(int, input().split())
# A = list(map(int, input().split()))
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()); #k泊まで
x = int(input()); #k泊まで1泊の値段
y = int(input()); #k泊以降1泊の値段
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())
print(x*(k if n>=k else n) + y*(n-k if n>=k else 0))

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

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

Submission status: Accepted

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

ans = (k*x + (n-k)*y) if n >= k else n*x
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 = 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, k, x, y = [int(input()) for _ 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(k*x+(n-k)*y if n-k>=0 else n*x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K,X,Y = map(int,open(0).read().split())
S = 0

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

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

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

Submission status: Accepted

Solution code:
NKXY = list(map(int,[input() for i in range(4)]))
ans=0
for i in range(NKXY[0]):
  if i <NKXY[1] :
    ans+=NKXY[2]
  else:
    ans+=NKXY[3]
print(ans)

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 print(N*X)]

Submission status: Accepted

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

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:
# -*- coding: utf-8 -*-
import math
n = int(input())
k = int(input())
x = int(input())
y = int(input())

total = 0
for i in range(n):
  price = x
  if i + 1 > k:
    price = y
  total += price

print(total)

Submission status: Accepted

Solution code:
def main(n, k, x, y):
    if n <= k:
        result = n * x
    else:
        result = k * x
        result += (n - k) * y
    return result


if __name__ == '__main__':
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())
    print(main(N, K, X, Y))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input());K=int(input());X=int(input());Y=int(input())
a=0
if N >= K:
    for i in range(1,K+1):
        a+=X
    for i in range(K+1,N+1):
        a+=Y

else:
    for i in range(1,N+1):
        a+=X
print(a)

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

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

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

print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

syukuhaku_kei = int(input())
rennzoku = int(input())
tousyo = int(input())
rennpaku  = int(input())

if syukuhaku_kei > rennzoku:
    first_sum = rennzoku*tousyo
    second_sum = (syukuhaku_kei - rennzoku) * rennpaku
    goukei = first_sum + second_sum
    print(str(goukei))
    
else:
    goukei = syukuhaku_kei* tousyo
    print(str(goukei))