Problem:


Score : 100 points

Problem Statement

There is a hotel with the following accommodation fee:

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

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

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

Constraints

1 \leq N, K \leq 10000

1 \leq Y < X \leq 10000

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

Input

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

N
K
X
Y

Output

Print Tak's total accommodation fee.

Sample Input 1

5
3
10000
9000

Sample Output 1

48000

The accommodation fee is as follows:

10000 yen for the 1-st night

10000 yen for the 2-nd night

10000 yen for the 3-rd night

9000 yen for the 4-th night

9000 yen for the 5-th night

Thus, the total is 48000 yen.

Sample Input 2

2
3
10000
9000

Sample Output 2

20000



Sample input:
5
3
10000
9000


Sample output:
48000

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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


if __name__ == '__main__':
    problemA()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if N<=K:
	print(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())
n2= int(input())
n3= int(input())
n4= int(input()) 

if n <= n2:
    one = n*n3
    print(one)
else:
    one = n2*n3
    two = (n-n2)*n4
    print(one + two)

Submission status: Accepted

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

Submission status: Accepted

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    K=I()
    X=I()
    Y=I()
    if N<=K:
        print(N*X)
    else:
        print(K*X+(N-K)*Y)

main()

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

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

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

Submission status: Accepted

Solution code:
#ABC044 A
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 _ in range(4)]
if N > K:
  print(K*X+(N-K)*Y)
else:
  print(N*X)

Submission status: Accepted

Solution code:
#abc044 a
n=int(input())
k=int(input())
x=int(input())
y=int(input())
z=min(n,k)
ans=x*z+y*(n-z)
print(ans)

Submission status: Accepted

Solution code:
import sys
import itertools
readline = sys.stdin.buffer.readline

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

Submission status: Accepted

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

print(p)

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

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

Submission status: Accepted

Solution code:
# A - 高橋君とホテルイージー
n=int(input())
k=int(input())
x=int(input())
y=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

X = int(input())
Y = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(fee)

Submission status: Accepted

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

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

print(sum)

Submission status: Accepted

Solution code:
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    n,k,x,y = (int(sys.stdin.readline().rstrip()) for i in range(4))

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A = [int(input()) for i in range(4)]
print(A[2]*min(A[0],A[1])+A[3]*max(0,A[0]-A[1]))

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
    elif i >= K:
        total += Y

print (total)

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

Submission status: Accepted

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

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(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
if N >= K:
    for i in range(K):
        sum += X
    for i in range(K,N):
        sum += Y
elif K >= N:
    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())

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
INF = float("inf")


def solve(N: int, K: int, X: int, Y: int):
    if N <= K:
        print(N*X)
    else:
        print(K*X+(N-K)*Y)
    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:
n=int(input())
k=int(input())
x=int(input())
y=int(input())
t=n-k
if t<0:
  t=0
  k=n
print(k*x+t*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:
    m = n-k
    print(k*x+m*y)

Submission status: Accepted

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

fee = 0
day = 1
if N < K:
    fee = N*X
else:
    while day <= K:
        fee += X
        day += 1
    while K < day <= N:
        fee += Y
        day += 1
    

print(fee)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# A - 高橋君とホテルイージー
N=int(input())
K=int(input())
X=int(input())
Y=int(input())
sum=0
N_count=N
K_count=K

while( (N_count>0) & (K_count>0) ):
    N_count-=1
    K_count-=1
    sum+=X
while( (N_count>0) & (K_count==0) ):
    N_count-=1
    sum+=Y
print(sum)

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))
result = 0
for _ in range(n):
    if _ < k:
        result += x
    elif _ >= k:
        result += y
print(result)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    staying_days, first_night, first_cost, latter_cost = [int(input()) for _ in range(4)]
    print(min(staying_days, first_night) * first_cost + max(0, staying_days - first_night) * latter_cost)


if __name__ == '__main__':
    main()

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

#----------
N,K,X,Y = [int(input().strip()) for _ in range(4)]
#----------

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

print(ans)

Submission status: Accepted

Solution code:
def syukuhakuhi(n, k, x, y):
    sum = 0
    for i in range(n):
        if (i + 1) <= k:
            sum += x
        else:
            sum += y
    return sum


string_list = [input() for i in range(4)]

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

answer = syukuhakuhi(n, k, x, y)
print(answer)

Submission status: Accepted

Solution code:
#!/use/bin/env python3

(n, k, x, y) = [int(input()) for _ in range(0, 4)]

ans = 0

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
 
 
def main():
 
    n_haku = int(input())
    k_haku = int(input())
    x_yen = int(input())
    y_yen = int(input())
    
    if n_haku <= k_haku:
        ryokin = x_yen * n_haku
    else:
        ryokin = x_yen * k_haku + y_yen * (n_haku - k_haku)

    print(ryokin)    
    
    return 0
 
 
if __name__ == '__main__':
    main()

Submission status: Accepted

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

if  n - k <0:
  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())

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

Submission status: Accepted

Solution code:
#A - 高橋君とホテルイージー

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

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

print(price)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


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


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:
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 os

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

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
  n, k, x, y = [int(input()) for i in range(4)]
  return x * n * (n <= k) + (x * k + (n - k) * y) * (k < n)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
a=[]
for i in range(4):
    b=int(input())
    a.append(b)
ans=0
for i in range(1,a[0]+1):
    if i<=a[1]:
        ans+=a[2]
    else:
        ans+=a[3]
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, K, X, Y = [int(input()) for i in range(4)]

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K,X,Y=map(int,open(0))
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())
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())
cos = 0
for i in range(N):
    if K >= (i + 1):
        cos += X
    else:
        cos += Y
    
    
print(cos)

Submission status: Accepted

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

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

print(val)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
k = int(input())
x = int(input())
y = int(input())

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc044/tasks/abc044_a
N = int(input())
K = int(input())
X = int(input())
Y = int(input())


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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print(n*x + (n>k)*(n-k)*(y-x))

Submission status: Accepted

Solution code:
# 入力　宿泊日数、割引前日数、宿泊費、割引宿泊費
days = int(input())
k = int(input())
fee1 = int(input())
fee2 = int(input())

# 総宿泊費の計算
if days <= k :
    all_fee = days * fee1
else :
    all_fee = k * fee1 + (days - k) * fee2

# 出力
print(all_fee)

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

Submission status: Accepted

Solution code:
N=int(input())
K=int(input())
X=int(input())
Y=int(input())
total=0
if  N<=K:
    total=X*N
elif K<N:
    total=X*K+Y*(N-K)

print(total)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
want = int(input())
due = int(input())
start = int(input())
over = int(input())
e = want - due
yen = 0
if e <= 0:
    for i in range(want):
        yen += start

if e > 0:
    for i in range(due):
        yen += start
    for j in range(e):
        yen += over
print(yen)

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

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

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys
import itertools

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K, X, Y = map(int, read().split())

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

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

print(ryoukin)

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