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:
stay = int(input())
plan_change_day =int(input())
high_price=int(input())
low_price=int(input())
 
def main():
    if stay - plan_change_day > 0:
        cost = high_price * plan_change_day + low_price * (stay - plan_change_day)
        print(int(cost))
    else:
        cost = high_price * stay
        print(int(cost))
  	    
main()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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((a-b) * d + b * c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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


if __name__ == "__main__":
    test()

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

Submission status: Accepted

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

total = 0
for a in range(1, N+1): #6 , 1, 2, 3, 4, 5
    if a <= K:
        total += X
    else:
        total += Y

print(total)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from fractions import gcd
import bisect
 
stdin = sys.stdin
 
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
s = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n, k, x, y = [ni() for _ in range(4)]

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

Submission status: Accepted

Solution code:
import sys
from fractions import gcd
import bisect
 
stdin = sys.stdin
 
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
s = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
k = ni()
x = ni()
y = ni()

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[0]*a[2]if a[0]<a[1]else 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())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import bisect
input = sys.stdin.readline
 
def main():
    n=int(input())
    k=int(input())
    x=int(input())
    y=int(input())
    
    if(n<=k):
        k=n
    
    print(k*x+(n-k)*y)
    
main()

Submission status: Accepted

Solution code:
def resolve():
    n =int(input())
    k =int(input())
    x =int(input())
    y =int(input())
    temp = max(0,n-k)
    if temp==0:
        print(x*n)
    else:
        print(x*k+y*temp)
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

sum1 = (k*x) 

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K,X,Y= map(int,open(0).read().split())
print(N*X if K > N else K*X + (N-K)*Y)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

fee = 0

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

print(fee)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#15:24
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(n*x if k > n else k*x + (n - k)*y)

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
a,b,c,d=[int(input()) for i in range(4)]
if a<=b:
  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())

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

Submission status: Accepted

Solution code:
n=int(input())
k=int(input())
x=int(input())
y=int(input())
print((k*x+(n-k)*y,n*x)[k>=n])

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if N <= K:
    print(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(0, (n - k)) * y)

Submission status: Accepted

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

Submission status: Accepted

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

charge = 0

for i in range(int(N)):
    if i < K:
        charge += X
    else:
        charge += Y
print charge

Submission status: Accepted

Solution code:
N = int(input()) # 宿泊数
K = int(input()) # 最初のK泊
X = int(input()) # 最初のK泊の料金
Y = int(input()) # K泊 + 1〜の料金

price = min(N, K) * X

if N > K:
    price += (N - K) * Y

print(price)

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

Submission status: Accepted

Solution code:
N=int(input())
K=int(input())
X=int(input())
Y=int(input())
 
a=K
b=N-K
c=N
 
if b>0:
	print(a*X+b*Y)
else:
	print(c*X)

Submission status: Accepted

Solution code:
w = [input() for i in range(4)]
N = int(w[0])
K = int(w[1])
X = int(w[2])
Y = int(w[3])

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

print(paid)

Submission status: Accepted

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

a=K
b=N-K
c=N

if b>0:
	print(a*X+b*Y)
else:
	print(c*X)

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

Submission status: Accepted

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

Submission status: Accepted

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

for t in range(1, n+1):
    if t <= 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( 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())

c = 0

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

print(c)

Submission status: Accepted

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
day = int(input())
d_line = int(input())
fee1 = int(input())
fee2 = int(input())

if day > d_line:
    total = d_line * fee1 + (day-d_line) * fee2
else:
    total = day * fee1
print(total)

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
 
nN = int(input())
nK = int(input())
nX = int(input())
nY = int(input())
 
nE = 0
nAns = 0
 
if nN <= nK:
  nAns = nX * nN
  print(nAns)
  sys.exit()
  
nE = nN - nK
 
nAns = (nX * nK) + (nY * nE)
print(nAns)

Submission status: Accepted

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

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

print(res)

Submission status: Accepted

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

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

print(fee)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

sum = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(N: int, K: int, X: int, Y: int):
    ret = X * min(N, K) + Y * max(0, N - K)
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(N, K, X, Y)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

from  collections import Counter
import sys

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

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





if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

answer = min(k,n)*x
if n>k:
  answer += (n-k)*y
print(answer)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = 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())
ans = 0

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

print("{}".format(ans))

Submission status: Accepted

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

Submission status: Accepted

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

sm = 0

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

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:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
if b>=a :
  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)]
z = X*N

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

Submission status: Accepted

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

Submission status: Accepted

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

s = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
x = int(input())
y = int(input())
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)
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, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
k = INT()
x = INT()
y = INT()

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

Submission status: Accepted

Solution code:
def smaller(x, y):
	if x < y:
		return x
	return y

N = int(input())
K = int(input())
X = int(input())
Y = int(input())
sum = 0
for i in range(0, smaller(N, K)):
	sum += X
for i in range(K, N):
	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:
    cost = N * X
    print(cost)
else:
    cost = K * X + (N - K) * Y
    print(cost)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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())
print(sum([c if i < b else d for i in range(a)]))

Submission status: Accepted

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

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

print(fee)

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