Problem:


Score : 100 points

Problem Statement

There is a hotel with the following accommodation fee:

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

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

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

Constraints

1 \leq N, K \leq 10000

1 \leq Y < X \leq 10000

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

Input

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

N
K
X
Y

Output

Print Tak's total accommodation fee.

Sample Input 1

5
3
10000
9000

Sample Output 1

48000

The accommodation fee is as follows:

10000 yen for the 1-st night

10000 yen for the 2-nd night

10000 yen for the 3-rd night

9000 yen for the 4-th night

9000 yen for the 5-th night

Thus, the total is 48000 yen.

Sample Input 2

2
3
10000
9000

Sample Output 2

20000



Sample input:
5
3
10000
9000


Sample output:
48000

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n = II()
    k = II()
    x = II()
    y = II()
    ans = 0
    for i in range(n):
        if i >= k:
            ans += y
        else:
            ans += x
    print(ans)
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n, k, x, y = II(),II(),II(),II()
    ans = 0
    for i in range(n):
        if i >= k:
            ans += y
        else:
            ans += x
    print(ans)
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n, k, x, y = IR(4)
    ans = 0
    for i in range(n):
        if i >= k:
            ans += y
        else:
            ans += x
    print(ans)
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()

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

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

print(min(a, b) * c + max(a - b, 0) * d)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#ABC44 A

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n<=k: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:
# -*- coding:utf-8 -*-

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

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

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
N, K, X, Y = map(int,stdin.read().splitlines())
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 < 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(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 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())

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

cost = 0
for i in range(1, data[0]+1):
    if( i <= data[1] ):
        cost += data[2]
    else:
        cost += data[3]
print(cost)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print (ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N = n()
K = n()
X = n()
Y = n()


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

Submission status: Accepted

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


abc()

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

Submission status: Accepted

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())

N = I()
K = I()
X = I()
Y = I()

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

print(ans)

Submission status: Accepted

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

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

bill = 0

for i in range(n):
    i += 1
    if k >= i:
        bill += x
    elif k < i:
        bill += y

print(bill)

Submission status: Accepted

Solution code:
day_all = int(input())
day_nor = int(input())
pay_nor = int(input())
pay_sar = int(input())
bonus = 0
if day_all > day_nor:
    bonus = pay_sar * (day_all - day_nor)
    pay_all = day_nor * pay_nor + bonus
else:
    pay_all = day_all * pay_nor
print(pay_all)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, 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())
c = 0

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

Submission status: Accepted

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

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

Submission status: Accepted

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

def larger(x, y):
	if x > y: return x
	return y

N = int(input())
K = int(input())
X = int(input())
Y = int(input())
print(X*smaller(K, N)+Y*larger(0, N-K))

Submission status: Accepted

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

Submission status: Accepted

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

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


abc()

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

x = X*N
if N > K:
  x += (Y-X)*(N-K)
print(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 = 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:
# -*- coding: utf-8 -*-

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(price)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

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

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

Submission status: Accepted

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

price = 0

if K > N:
    K = N

for i in range(0, K):
    price += X

for i in range(K, N):
    price += Y

print(price)

Submission status: Accepted

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

Submission status: Accepted

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

x = int(input())
y = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
k=int(input())
c=int(input())
d=int(input())

ans=0
for i in range(n):
  if i<k:
    ans+=c
  else:
    ans+=d
print(ans)

Submission status: Accepted

Solution code:
day, slit, fee1, fee2 = [int(input()) for i in range(4)]

total = 0

for j in range(day):
    if j < slit:
        total += fee1
    else:
        total += fee2



print(total)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())
###template###

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import itertools
import sys
import math
from functools import lru_cache

# 1整数
# n = int(input())

# 空白区切り2変数
from queue import Queue
from operator import mul
from functools import reduce
from queue import Queue
from operator import mul
from functools import reduce
from functools import lru_cache

input = sys.stdin.readline

# N個整数
# a, b, c = list(map(int, input().split()))

# 1整数
n = int(input())
k = int(input())
x = int(input())
y = int(input())

# 空白区切りリスト整数
# b = list(map(int, input().split()))

# 空白区切り文字列
# t, d = input().split()


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

Submission status: Accepted

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

    r = 0

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

    print(r)


if __name__ == '__main__':
    main()

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, = list(map(int,input().split()))
K, = list(map(int,input().split()))
X, = list(map(int,input().split()))
Y, = list(map(int,input().split()))
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())
ans = min(N, K) * X + max(N - K, 0) * Y
print(ans)

Submission status: Accepted

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

# print(n)
# print(k)
# print(x)
# print(y)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
all_days=int(input())
days1=int(input())
sp_p=int(input())
n_p=int(input())
ans = 0

if all_days <= days1:
    ans = sp_p * all_days
else:
    ans = days1 * sp_p + (all_days-days1) * n_p

print(ans)

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

Submission status: Accepted

Solution code:
n,k,x,y=map(int,open(0))
print(min(k,n)*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:
n=int(input())#泊まる日数
k=int(input())#変更日付
x=int(input())
y=int(input())
a=b=i=0
if n<=k:
 for i in range(n):
   a+=x
   i+=1
else:
 for i in range(k):
   a+=x
   i+=1 
i=0
if n>k:
 for i in range(n-k):
   a+=y
   i+=1
print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

cost1=int(input())
cost2=int(input())

if Alldays-days1<0:
	print(Alldays*cost1)

else:
	print(days1*cost1+(Alldays-days1)*cost2)

Submission status: Accepted

Solution code:
#A問題
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:
# -*- coding: utf-8 -*-
 
# 整数の入力
n = int(input())
k = int(input())
x = int(input())
y = int(input())

# 計算
sum = 0
for num in range(n) :
    if num <= k-1 :
        sum += x
    else :
        sum += y

# 出力
print(sum)

Submission status: Accepted

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

amount = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = [0] * 4
for i in range(4):
    n[i] = int(input())

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

Submission status: Accepted

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

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

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

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:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
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)];print(min(N,K)*X+max(N-K,0)*Y)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

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:
# -*- coding: utf-8 -*-

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

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

Submission status: Accepted

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