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:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# AtCoder Beginner Contest 044
# A - 高橋君とホテルイージー / Tak and Hotels (ABC Edit)
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
total = 0
if N > K:
    total = X*K + Y*(N-K)
else:
    total = X*N
print(total)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N,K,X,Y=[int(input()) for _ in range(4)]
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())

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

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

sum = 0

for i in range(N):
    if i <= K - 1:
        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 :
    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(int(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())
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 = int(input())
k = int(input())
x = int(input())
y = int(input())

r = 0

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

Submission status: Accepted

Solution code:
n = int(input().split()[0])
k = int(input().split()[0])
x = int(input().split()[0])
y = int(input().split()[0])

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
print(sum([X if K>=j else Y for j in range(1, N+1)]))

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

Submission status: Accepted

Solution code:
def is_over_threshold_days(stay_days, threshold_days):

    if stay_days <= threshold_days:
        return False
    if stay_days > threshold_days:
        return True

def calc_accomodation_fee(stay_days, threshold_days, 
                                first_fee, second_fee):

    if is_over_threshold_days(stay_days, threshold_days):
        sum_of_first_fee = first_fee * threshold_days
        sum_of_second_fee = second_fee * (stay_days - threshold_days)
        return sum_of_first_fee + sum_of_second_fee
    else:
        return stay_days * first_fee

if __name__=='__main__':
    stay_days, threshold_days, first_fee, second_fee = [int(input()) for i in range(4)]
    print(calc_accomodation_fee(stay_days, threshold_days, first_fee, second_fee))

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

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,k,x,y = (int(input()) for _ in range(4))
print(min(n,k)*x + y*max(n-k,0))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(A)

Submission status: Accepted

Solution code:
import sys

# N 宿泊数
n = int(input())

# K 最初のX円までの宿泊数
k = int(input())

# X 最初のK日までの金額
x = int(input())

# Y K+1日以降の金額
y = int(input())

# X円, Y円での宿泊数
if n > k:
    day_x = k
    day_y = n - k
else:
    day_x = n
    day_y = 0
    
print(x * day_x + y * day_y)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #n = int(stdin.readline()[:-1])   
    #r = stdin.readline()[:-1]
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    t = [int(stdin.readline()) for i in range(4)]
    #n = int(r)
    #a = r.split()
    #a,b,c = r.split()
    #a = list(map(int, r.split()))
    #a,b,c,d = map(int, r.split())
    #a = [int(s[i]) for i in range(1, n+1)]
    #a = [list(map(int, r.split())) for i in range(1,n+1)]
    res = 0
    for i in range(t[0]):
        if i < t[1]:
            res += t[2]
        else:
            res += t[3]

    print(res)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

total = 0
if N-K < 0:
    for _ in range(N):
        total += X
else:
    for _ in range(K):
        total += X

    for _ in range(N-K):
        total += Y

print(total)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

sum = 0

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

print(sum)

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

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:
import sys
input = sys.stdin.readline
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:
import sys

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

print(sum)

Submission status: Accepted

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

total_cost = 0
for i in range(N):
	if K - 1 >= i:
		total_cost += X
	else:
		total_cost += Y

print(total_cost)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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+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(1,n+1):
    if i <= k:
        total += x
    else:
        total += y

print(total)

Submission status: Accepted

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

if a[0] < a[1]:
	print(a[0] * a[2])
else:
	print(int(a[1]) * int(a[2]) + (int(a[0]) - int(a[1])) * int(a[3]))

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

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

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

Submission status: Accepted

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

ac_fee = 0

if (N - K) > 0:
    for i in range(1, K+1):
        ac_fee += X
    for j in range(K+1, N+1):
        ac_fee += Y
else:
    for k in range(1, N+1):
        ac_fee += X
    
print(ac_fee)

Submission status: Accepted

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

result = n*x

if n-k > 0:
  result -= (n-k)*(x-y)

print (result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
ans = 0
for i in range(min(N, K)): ans += X
N = max(0, N - K)
for i in range(N): 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())
sum=0
for i in range(n):
  if i+1<=k:
    sum+=x
  else:
    sum+=y
print(sum)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if K >= N:
    print(X * N)
else:
    print(X * K + (N - K) * Y)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(total)

Submission status: Accepted

Solution code:
import math
import fractions

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

print(ans)

Submission status: Accepted

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

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

    
print(answer)

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

ryokin=0

if n <= k :
    ryokin = n*x

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

print(ryokin)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# # -*- coding: utf-8 -*-
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

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

Submission status: Accepted

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

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
import sys


def main(argv=sys.argv):

    actual_stay = int(input())

    init_stay = int(input())

    init_charge = int(input())

    extra_charge = int(input())

    total_charge = 0

    if actual_stay > init_stay:

        total_charge = init_stay * init_charge + \
                       (actual_stay - init_stay) * extra_charge

    else:

        total_charge = actual_stay * init_charge

    print(total_charge)

    return 0


if __name__ == '__main__':
    sys.exit(main())

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

def main(argv=sys.argv):
  
  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)
  
  
  return 0

if __name__ =='__main__':
  sys.exit(main())

Submission status: Accepted

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

Submission status: Accepted

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

X_days = min(N, K)
Y_days = N - X_days
ans = X*X_days + Y*Y_days
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def main():
    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())
    ans = 0
    if n>=k:
        ans = x * k + y * (n - k)
    else:
        ans = x * n
    print(ans)
    return

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
lst = list(int(input()) for _ in range(4))

print(lst[0]*lst[2] if lst[0]<=lst[1] else lst[1]*lst[2]+lst[3]*(lst[0]-lst[1]))

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# AtCoder Beginner Contest 044 - A
# -*- encoding: UTF-8 -*-
n = int(input())
k = int(input())
x = int(input())
y = int(input())

total = 0

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

else :
  total = int(n * x)

print(total)

Submission status: Accepted

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

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

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

a = abs(n - k)

if n < k:
    print(n * x)
else:
    print(k * x + a * 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(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 + 1 :
   tot = N * X
else : 
   tot = K * X + ( N - K ) * Y
  
print( tot )

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print(z)

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 i in range(4)]
print(min(k*x+(n-k)*y,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:
import sys

n, k, x, y = map(int, sys.stdin.read().split())

def main():
    if n > k:
        return x * k + y * (n - k) 
    return x * n

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Accepted

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

xk = min(k, n)
yk = max(0, n - k)

print(xk * x + yk * y)