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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

    print(res)


if __name__ == "__main__":
    main()

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

lat = 0 if N < K else N - K

print((N-lat) * X + lat * Y)

Submission status: Accepted

Solution code:
N = input()
K = input()
X = input()
Y = input()
if(X < Y):
	tmp = X
	X = Y
	Y = tmp

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

Submission status: Accepted

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

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:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
count = 0
for i in range(1,a+1):
    if i > b:
        count += d
    else:
        count += c
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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(y * n + (x - y) * k)

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
days_to_stay = int(input())
special_days = int(input())
normal_price = int(input())
special_price = int(input())
payment = 0 

if days_to_stay <= special_days:
    payment = days_to_stay * normal_price
else:
    payment = (days_to_stay - special_days) * special_price + special_days * normal_price
    
print(payment)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#! /usr/bin/python3
# ABC044_A
# A - 高橋君とホテルイージー / Tak and Hotels (ABC Edit)

"""
制約
    1 ≤ N,K ≤ 10000
    1 ≤ Y < X ≤10000
    N, K ,X ,Y はいずれも整数である
"""


def main():
    """
    全体の処理を実行するmain関数
    """
    N = int(input())  # 宿泊日程 N泊
    K = int(input())  # 価格の変わる基準
    X = int(input())  # K泊までの宿泊費
    Y = int(input())  # K+1泊目以降の宿泊費

    charges = 0 # 宿泊費の合計

    if N <= K:
        charges += N*X
    else:
        charges += K*X + (N-K)*Y
    # 宿泊費の算出

    print(charges)
    # 宿泊費の出力

if __name__ == '__main__':
    main()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
if a>b:
    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())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


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


if __name__ == '__main__':
    main()

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

Submission status: Accepted

Solution code:
#coding: utf-8
N, K, X, Y = [int(input()) for _ in range(4)]
print(X * K + (N-K) * Y 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(X*N)
else:
    print(K*X+(N-K)*Y)

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)

Z = N - K
#print(Z)
#print()

if Z >= 0:
    mae = K * X
    ato = Z * Y
    print(mae + ato)
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 = 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,k,x,y = map(int,open(0).read().split())
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(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 = int(input())
k = int(input())
x = int(input())
y = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if n < k:
    a, b = n, 0
else:
    a, b = k, n - k

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n = int(input())
k = int(input())
x = int(input())
y = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c,d=(int(input()) for _ in range(4))
if a<=b:print(a*c)
else:print(b*c+(a-b)*d)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = [int(input()) for _ in range(4)]

if n[0] > n[1]:
    print(n[3] * (n[0]-n[1]) + n[2] * n[1])
else:
    print(n[2]*n[0])
exit(0)

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

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#44a
n = int(input())
k = int(input())
x = int(input())
y = int(input())
ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = [int(input()) for _ 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, k, x, y = map(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 = 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(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+Y*(N-K))

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:
lis = [int(input()) for i in range(4)]
if lis[0] > lis[1]:
    print(lis[1]*lis[2]+(lis[0]-lis[1])*lis[3]) 
else:
    print(lis[1]*lis[2]+(lis[0]-lis[1])*lis[2])

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

if __name__ == "__main__":
        main()

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if N <= K:
    a = N * X
    print(a)

elif N > K:
    a = K * X + (N - K) * Y
    print(a)

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

Submission status: Accepted

Solution code:
import sys
n,k,x,y=map(int,sys.stdin)
print(x*min(n,k)+(n-k)*(n>k)*y)

Submission status: Accepted

Solution code:
n = int(raw_input())
k = int(raw_input())
x = int(raw_input())
y = int(raw_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())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print (res)

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

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

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

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

Submission status: Accepted

Solution code:
a=[input() for i in range(4)]
n=int(a[0])
k=int(a[1])
x=int(a[2])
y=int(a[3])
cost=0

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, K, X, Y = map(int, [input() for _ in range(4)])
ans = 0
for n in range(N):
  if n+1 >= K+1:
    ans += Y
  else:
    ans += X
print(ans)

Submission status: Accepted

Solution code:
l = [int(input()) for i in range(4)]
if l[0]<=l[1]:
    print('{}'.format(l[0]*l[2]))
else:
    print('{}'.format(l[1]*l[2]+(l[0]-l[1])*l[3]))

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

#print(a)
#print(a[0],a[1],a[2],a[3])
if a[1] > a[0]:
  a[1] = a[0]
  
sum = a[1]*a[2] + a[3]*(a[0]-a[1]) 
print(sum)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    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())
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())

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

print(sum)

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
#宿泊数
n = int(input())
#最初の宿泊数
k = int(input())
#最初の金額
x = int(input())
#以降の金額
y = int(input())

if n < k:
    k = n

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

Submission status: Accepted

Solution code:
inn = int(input())
ink = int(input())
inx = int(input())
iny = int(input())

if inn <= ink:
  print(inn*inx)
else:
  print(ink*inx+(inn-ink)*iny)

Submission status: Accepted

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

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

print calc(N, K, X, Y)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

# AtCoder Beginner Contest
# Problem A

if __name__ == '__main__':
    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())
    diff = n - k

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

Submission status: Accepted

Solution code:
def inpn(): return int(input())
N, K, X, Y = inpn(), inpn(), inpn(), inpn()
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:
import sys
import io


def run(input: io.TextIOBase, output: io.TextIOBase):
    n = int(input.readline())
    k = int(input.readline())
    x = int(input.readline())
    y = int(input.readline())

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

    output.write(str(r) + '\n')


if __name__ == '__main__':
    run(sys.stdin, sys.stdout)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

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


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

Submission status: Accepted

Solution code:
# coding: utf-8
n = int(input())
k = int(input())
x = int(input())
y = int(input())

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

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

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(raw_input())
k = int(raw_input())
x = int(raw_input())
y = int(raw_input())
print min(k, n) * x + (n - k) * y if n > k else min(k, 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(X*N)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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