Problem:


Score : 100 points

Problem Statement

There is a hotel with the following accommodation fee:

X yen (the currency of Japan) per night, for the first K nights

Y yen per night, for the (K+1)-th and subsequent nights

Tak is staying at this hotel for N consecutive nights.
Find his total accommodation fee.

Constraints

1 \leq N, K \leq 10000

1 \leq Y < X \leq 10000

N,\,K,\,X,\,Y are integers.

Input

The input is given from Standard Input in the following format:

N
K
X
Y

Output

Print Tak's total accommodation fee.

Sample Input 1

5
3
10000
9000

Sample Output 1

48000

The accommodation fee is as follows:

10000 yen for the 1-st night

10000 yen for the 2-nd night

10000 yen for the 3-rd night

9000 yen for the 4-th night

9000 yen for the 5-th night

Thus, the total is 48000 yen.

Sample Input 2

2
3
10000
9000

Sample Output 2

20000



Sample input:
5
3
10000
9000


Sample output:
48000

Submission status: Accepted

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

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

Submission status: Accepted

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

else:
    sum = n * x
print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    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())
first_half = K * X if N - K > 0 else N * X
rest = N - K if N - K > 0 else 0
print(first_half + rest * Y)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N,K,X,Y=map(int,open(0));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(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(x*min(k,n)+max(0,n-k)*y)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
s=[input() for i in range(4)]
sum=0

for N in range(1,int(s[0])+1):
    if N < int(s[1])+1:
        sum += int(s[2])
    else:
        sum += int(s[3])
    

print(sum)

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

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

Submission status: Accepted

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

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:
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    k = int(input().rstrip('\n'))
    x = int(input().rstrip('\n'))
    y = int(input().rstrip('\n'))
    t = 0
    for i in range(n):
        if i + 1 > k:
            t += y
        else:
            t += x
    print(t)


if __name__ == '__main__':
    slove()

Submission status: Accepted

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

else:
	cost = N * X

print(cost)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

print(sum([X if _ < K else Y for _ in range(N)]))

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

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

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:
#2019/09/27
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())

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

elif N < K:
  S=N*X

print(S)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

print(fee)

Submission status: Accepted

Solution code:
N = int(input()) #N泊する
K = int(input())
X = int(input())
Y = int(input()) #K+1泊以降

t = N-K #この日数分はYの値段
if t > 0:
	print(X*K+Y*t)
else:
  print(X*N)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
def do():
    n = INT()
    k = INT()
    x = INT()
    y = INT()
    if n<=k:
        print(n*x)
    else:
        print(k*x+(n-k)*y)
if __name__ == '__main__':
    do()

Submission status: Accepted

Solution code:
#coding:utf-8

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

acc = 0

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

print(acc)

Submission status: Accepted

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

N, K, X, Y = input_

acc = 0

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

print(acc)

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    resolve()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(result)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#ABC044A
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)]
print(n * x + (y-x) * max(n-k,0))

Submission status: Accepted

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

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

total_amount = 0

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N,K,X,Y=map(int,open(0));print([N*X,K*X+(N-K)*Y][K<N])

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=map(int,open(0));print([n*x,k*x+(n-k)*y][n>k])

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
days=int(input())
k=int(input())
yen_until_k=int(input())
yen_after_k=int(input())
if days <= k:
  print(days*yen_until_k)
else:
  print(k*yen_until_k+(days-k)*yen_after_k)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
source = []
for i in range(4):
    source.append(input())
N = list(map(int, source))
N, K, X, Y = N[0], N[1], N[2], N[3]
if N <= K:
    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())

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

Submission status: Accepted

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N=int(input())
K=int(input())
X=int(input())
Y=int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
from collections import deque

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n, k, x, y = [ni() for _ in range(4)]
print(x * min(n, k) + y * max((n - k), 0))

Submission status: Accepted

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

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

x_sum = 0
if n < k:
  x_sum = n * x
else:
  x_sum = k * x

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

Submission status: Accepted

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

    if n <= k:
        print(n * x)
    else:
        print(k * x + (n - k) * y)
    pass
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():                                                                     
  n, k, x, y = int(raw_input()), int(raw_input()), int(raw_input()), int(raw_input())
  total = 0                                                                     
  for i in xrange(1, n+1):                                                      
    total += x if i <= k else y                                                 
  print(total)                                                                  
                                                                                
main()

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():

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

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

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

Submission status: Accepted

Solution code:
days = int(input())
boundary = int(input())
fee_before = int(input())
fee_after = int(input())

print(min(days, boundary)*fee_before+max(0, (days-boundary))*fee_after)

Submission status: Accepted

Solution code:
days = int(input())
boundary = int(input())
fee_before = int(input())
fee_after = int(input())

if days <= boundary:
    print(days*fee_before)
else:
    print(boundary*fee_before+(days-boundary)*fee_after)

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

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)

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

Submission status: Accepted

Solution code:
n,k,x,y=map(int,open(0));print(n*x if n<=k else x*k+y*(n-k))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    K = inputInt()
    X = inputInt()
    Y = inputInt()
    
    if N <= K:
        print(N*X)
    else:
        print((K*X) + ((N-K)*Y))
    
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
x=0
for i in range(a):
  if i < b:
    x += c
  else:
    x += d
print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

money = 0
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 i in range(4))
print(X*K+Y*(N-K) if N>K else X*N)

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

else:
    total_price = K * X + Y * (N - K)

print(total_price)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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