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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
a=int(input())
b=int(input())
c=int(input())

if n <= a:
  print(n*b)
else:
  print(a*b+(n-a)*c)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if n <= k:
	price = x*n

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

print(price)

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
k=int(input())
x=int(input())
y=int(input())
s1=k*x
d1=n-k
s2=d1*y

if( k>=n):
    s=x*n
    print(s)
else:
    print(s1+s2)

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())
    res = 0
    cnt = 1
    while cnt<=n:
        if cnt <= k:
            res += x
        else:
            res += y
        cnt += 1
    print(res)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

AC=0

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

print(AC)

Submission status: Accepted

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

P=N-K


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

Submission status: Accepted

Solution code:
arr = []
for _ in range(4):
  arr.append(int(input()))

if arr[1] > arr[0]:
  arr[1] = arr[0]
charge = arr[1]*arr[2] + (arr[0]-arr[1])*arr[3]
print(charge)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

ex=N-K
if ex<0:
  charge=N*X
else:
  charge=K*X+ex*Y

print(charge)

Submission status: Accepted

Solution code:
day = int(input())
posreday= int(input())
price = int(input())
posreprice = int(input())
if day<= posreday:
  print(day * price)
elif day > posreday:
  print(posreday * price + (day - posreday) * posreprice)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())

if (a-b)<0:
  print(c*a)
else:
  print(c*b +d*(a-b))

Submission status: Accepted

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

print(sum([X if K >= i else Y for i in range(1, N+1)]))

Submission status: Accepted

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

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

print(price)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(price)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
k = 1 
result = 0
if K < N:
    while k <= K:

        result += X
        k += 1
    while k <= N:

        result += Y
        k += 1
if K >= N:
    while k <= N:
        result += X
        k += 1
print(result)

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, k, x, y = nin(4)

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

Submission status: Accepted

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

fee = 0

for i in range(N):
    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())


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

discounted_dates = N - K
if discounted_dates < 0:
    discounted_dates = 0

print((N * X) - (X - Y) * discounted_dates)

Submission status: Accepted

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

Submission status: Accepted

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

main()

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

Submission status: Accepted

Solution code:

import collections


def solve(n, k, x, y):
    return min(n, k) * x + max(0, n-k) * y


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

print(solve(n, k, x, y))

Submission status: Accepted

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

tot=0

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:input()

"""========main code==============="""

t=ii()
x=ii()
y=ii()
z=ii()
k=min(t,x)
print(k*y+(t-k)*z)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

kx = min(N, K)
ky = max(N, K) - K
print(X*kx + Y*ky)

Submission status: Accepted

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

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


print(total)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
  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:
# python 3.4.3
import sys
input = sys.stdin.readline
import numpy as np

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
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:
nancy=int(input())
kite=int(input())
xmas=int(input())
yanke=int(input())
if nancy>kite:
  print((nancy-kite)*yanke+xmas*kite)
else:
  print(xmas*nancy)

Submission status: Accepted

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

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

Submission status: Accepted

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


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

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

Submission status: Accepted

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

ans=0

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

Submission status: Accepted

Solution code:
li = list(int(input()) for i in range(4))

if li[0] > li[1]:
    ans = li[1]*li[2] + (li[0]-li[1])*li[3]
else:
    ans = li[0]*li[2]
print(str(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:
  total = N*X- (N-K)*(X-Y)
  print(total)
else:
  total = N*X
  print(total)

Submission status: Accepted

Solution code:
x=[]
for i in range(0,4):
  x.append(int(input()))
s=0
for j in range(0,x[0]):
  if j+1<=x[1]:
    s+=x[2]
  else:
    s+=x[3]
    
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(cost)

Submission status: Accepted

Solution code:
url = "https://atcoder.jp/contests/abc044/tasks/abc044_a"

def main():

    n = [int(input()) for i in range(4)]
    if n[0] > n[1]:
        n1 = (n[0] - n[1]) * n[3]
        n2 = n[1] * n[2]
    else:
        n1 = 0
        n2 = n[0] * n[2]
    print(n1 + n2)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

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

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

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

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

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

print(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 = 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())
if(a<b):
    b=a

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

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

if __name__ ==  '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC 044: A – 高橋君とホテルイージー / Tak and Hotels (ABC Edit)
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:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if(N <= K):
  fee=N*X
else:
  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:
    a = n
    b = 0
else:
    a = k
    b = n-k
ans = x * a + y * b
print(ans)

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, 1):
    if i <= K:
        total += X
    else:
        total += Y

print(total)

Submission status: Accepted

Solution code:
N,K,X,Y=map(int,open(0));print(N*X-max(0,(N-K)*(X-Y)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())
    a1=0
    a2=0
    if n<=k:
        a1=n
    else:
        a1=k
        a2=n-k


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

Submission status: Accepted

Solution code:
"""
in1 = '5'
in2 = '3'
in3 = '10000'
in4 = '9000' #48000
in1 = '2'
in2 = '3'
in3 = '10000'
in4 = '9000' #20000
"""
in1 = input()
in2 = input()
in3 = input()
in4 = input()

N = int(in1)
K = int(in2)
X = int(in3)
Y = int(in4)
RC = 0

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

print(RC)

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

Submission status: Accepted

Solution code:
# /usr/bin/python3
# -*- coding: utf-8 -*-
from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt, floor, ceil, log2
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key



__MOD__=(10**9)+7
yn = 'YNeos'
judge = False
cnt = 0
ans = None


def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

def mulinputs():
    return map(int,input().split())

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas

class ModInt():
    def __init__(self, x):
        self.__x = (x % __MOD__)
    def __add__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x + other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x + other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __sub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x - other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x - other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __mul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __truediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __pow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(self.__x, other.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(self.__x, other.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")
    def __modinv(self, m=__MOD__):
        a = self.__x
        if a == 0:
            raise ZeroDivisionError()
        if gcd(a, m) != 1:
            raise Exception("%sの逆数は求まりません。" % a)
        b, u, v = m, 1, 0
        while b != 0:
            t = a//b;
            a -= t*b
            a, b = b, a
            u -= t * v
            u, v = v, u
        u %= m
        if u < 0:
            u += m
        return u
    def __int__(self):
        return self.__x



if __name__ == '__main__':
    N = intinput()
    K = intinput()
    X = intinput()
    Y = intinput()

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



# EOF

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