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:
from Queue import * # Queue, LifoQueue, PriorityQueue
from bisect import * #bisect, insort
from collections import * #deque, Counter,OrderedDict,defaultdict
#set([]) 
import math
import copy
import itertools
import string
import sys
myread = lambda : map(int,raw_input().split())
def solver():
    N = int(raw_input())
    K = int(raw_input())
    X = int(raw_input())
    Y = int(raw_input())
    if N <= K:
        print N * X
    else:
        print K * X + (N-K) * Y 




if __name__ == "__main__":
    solver()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#/usr/bin/python3

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(res)

Submission status: Accepted

Solution code:
'''
Created on 2016/08/28

@author: diyosko7
'''

if __name__ == '__main__':
    n = 4 
    input_lines = [int(input()) for i in range(n)] 
    N = int(input_lines[0])
    K = int(input_lines[1])
    X = int(input_lines[2])
    Y = int(input_lines[3])
    

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

Submission status: Accepted

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

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

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(raw_input())
K=int(raw_input())
X=int(raw_input())
Y=int(raw_input())

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

print price

Submission status: Accepted

Solution code:
# coding: utf-8
n = 0
k = 0
x = 0
y = 0
t = 0

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

Submission status: Accepted

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

if N > K:
    X_Day = K
    Y_Day = N - K
else:
    X_Day = N
    Y_Day = 0

Price = X * X_Day + Y * Y_Day

print(Price)

Submission status: Accepted

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

price = 0

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

print(price)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys 

N = int(sys.stdin.readline())
K = int(sys.stdin.readline())
X = int(sys.stdin.readline())
Y = int(sys.stdin.readline())

#X* K + Y * (N-K)
# if N > K

#X * K
# if N < K

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
answer = 0
counter = 1
while counter <= N:
	if(counter <= K):
		answer += X
	else:
		answer += Y
	counter += 1
print (answer)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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:
# Enter your code here. Read input from STDIN. Print output to STDOUT
from sys import stdin
n = int(stdin.readline())
k = int(stdin.readline())
x = int(stdin.readline())
y = int(stdin.readline())
if n<=k:
    print n*x
else:
    print k*x + (n-k)*y

Submission status: Accepted

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

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

Submission status: Accepted

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


if N <= K:
    print(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(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())

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

print(cost)

Submission status: Accepted

Solution code:
import re
import doctest


class IO_for_Contest(object):
    @staticmethod
    def my_input():
        # return raw_input()
        return input()

    @staticmethod
    def read_from_input():
        n = IO_for_Contest.read_int()
        k = IO_for_Contest.read_int()
        x = IO_for_Contest.read_int()
        y = IO_for_Contest.read_int()
        return n, k, x, y

    @staticmethod
    def read_line():
        return IO_for_Contest.my_input().strip()

    @staticmethod
    def read_int():
        return int(IO_for_Contest.my_input().strip())

    @staticmethod
    def read_n_int(n):
        return list(map(
                    int,
                    re.split('\s+', IO_for_Contest.my_input().strip())))[: n]


def solve():
    buf = IO_for_Contest.read_from_input()
    n = buf[0]
    k = buf[1]
    x = buf[2]
    y = buf[3]
    if n <= k:
        print(x * n)
    else:
        rem = n - k
        print(x * k + y * rem)


if __name__ == '__main__':
    # doctest.testmod()
    solve()

Submission status: Accepted

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

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

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 += y
    else:
        sum += x

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline())
k = int(stdin.readline())
x = int(stdin.readline())
y = int(stdin.readline())

first = min(n, k)
second = n - k
if second < 0:
    second = 0

print(x * first + y * second)

Submission status: Accepted

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

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

print sum

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: Runtime Error

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

Submission status: Runtime Error

Solution code:
    n, k, price, special = map(int, input().split())
    result = 0
    for i in range(n):
        if i < k:
            result += price
        else:
            result += special

Submission status: Runtime Error

Solution code:
    n, k, price, special = map(int, input().split())
    result = 0
    for i in range(n):
        if i < k:
            result += price
        else:
            result += special
    
    print(result)

Submission status: Runtime Error

Solution code:
def iroha():
    n, k, price, special = map(int, input().split())
    result = 0
    for i in range(n):
        if i < k:
            result += price
        else:
            result += special
    
    print(result)
            

if __name__ == "__main__":
    iroha()

Submission status: Runtime Error

Solution code:
def iroha():
    n, k, price, special = map(int, input().split())
    result = 0
    for i in range(n):
        if i < k:
            result += price
        else:
            result += special
    
    print(result)
            

if __name__ == "__main__":
    iroha()

Submission status: Runtime Error

Solution code:
n, k, price, special = map(int, input().split())
    result = 0
    for i in range(n):
        if i < k:
            result += price
        else:
            result += special
    
    print(result)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if(K>N):
  N=K
else:
  

Z=K*X+(N-K)*Y
print(Z)

Submission status: Runtime Error

Solution code:
# abc044_a
# https://atcoder.jp/contests/abc044/tasks/abc044_a

# 最初のK泊までは、X円
# K＋1泊目以降は、Y円

# N泊連続で宿泊した際の宿泊費

# 入力
n, k, x, y = map(int, input().split())

# 処理

# x円とy円
if n > k:
    answer = k * x + (n - k) * y
# x円のみ
else:
    answer = n * x

print(answer)

Submission status: Runtime Error

Solution code:
k, x, y, n = map(int, input().split())

if n <= k:
    print(n * x)
else:
    print(k*x+(n-k)*y)
# 演算子の左右に空白を入れる！

Submission status: Runtime Error

Solution code:
N,K,X,Y= map(int, input().split())
yen1 = K * X
yen2 = (N - K) * Y
print(yen1 + yen2)

Submission status: Runtime Error

Solution code:


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

a = N * X

b = K * X + (N - K) * Y

if N <= K:
    print(a)
else:
    print(b)

Submission status: Runtime Error

Solution code:

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

a = N * X

b = K * X + (N - K) * Y

if N < K:
    print(a)
else:
    print(b)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n, k, x, y = map(int, input().split())

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

Submission status: Runtime Error

Solution code:
n, k, x, y = map(int, input().split())

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

Submission status: Runtime Error

Solution code:
n, k, x, y = map(int, input().split())

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

Submission status: Runtime Error

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

if N <= K:
    print(N * X)

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

Submission status: Runtime Error

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

if N <= K:
    answer = N * X
    print(answer)

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

Submission status: Runtime Error

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

# 高橋くんの宿泊数 N
# 宿泊費が変わる　 K
# 初期宿泊費      X
# K+1以降の宿泊費 Y

# subは宿泊数の超過分
sub = N - K

# もしNよりKが大きい場合、そのまま計算する
if N <= K:
    answer = N * X
    print(answer)
# KよりNが大きい場合 K * X + (N - K) * Y
else:
    answer = K * X + sub * Y
    print(answer)

Submission status: Runtime Error

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

# 高橋くんの宿泊数 N
# 宿泊費が変わる　 K
# 初期宿泊費      X
# K+1以降の宿泊費 Y

# subは宿泊数の超過分
sub = N - K

# もしNよりKが大きい場合、そのまま計算する
if N < K:
    answer = N * X
    print(answer)
# KよりNが大きい場合 K * X + (N - K) * Y
elif K < N:
    answer = K * X + sub * Y
    print(answer)

Submission status: Runtime Error

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


# 高橋くんの宿泊数 N
# 宿泊費が変わる　 K
# 初期宿泊費      X
# K+1以降の宿泊費 Y

# wは宿泊数の超過分
sub = N - K

# もしNよりKが大きい場合、そのまま計算する
if N < K :
    answer = N * X
    print(answer)
# KよりNが大きい場合
elif K < N:
    answer = K * X + Y * sub
    print(answer)

Submission status: Runtime Error

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


answer = 0
w = 0

# 高橋くんの宿泊数 N
# 宿泊費が変わる　 K
# 初期宿泊費      X
# K+1以降の宿泊費 Y

# wは宿泊数の超過分
if N - K >= 1:
    w = N - K
else:
    w = 0
# もしNよりKが大きい場合、そのまま計算する
#
if N < K :
    for i in range(N):
        answer = answer + X
    print(answer)
# KよりNが大きい場合
elif K < N:
    for i in range(K):
        answer = answer + X
    for i in range(w):
        answer = answer + Y
    print(answer)

Submission status: Runtime Error

Solution code:
total_stay = int(input())
normal_stay = int(input())
normal_cost = int(input())
discounted_cost = int(input())
if total_stay <= normal_stay:
  total_cost = total_stay * normal_cost
else:
  total_cost = normal_stay * normal_cost + (total_stay - normal_stay) * discounted_cost
print(P)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# 一泊X円、N(泊数)がK泊より多ければその分だけ一泊Y円
N,K,X,Y = map(int,input().split())
# K泊より多い場合はその分だけ単価Y円を掛ける
if N > K:
    total_price = K * X + (N - K) * Y
# K泊より少ない場合は泊数に単価X円を掛ける
else:
    total_price = N * X

print(total_price)

Submission status: Runtime Error

Solution code:
# 一泊X円、N(泊数)がK泊より多ければその分だけ一泊Y円
N,K,X,Y = map(int,input().split())
# K泊より多い場合はその分だけ単価Y円を掛ける
if N >= K:
    total_price = K * X + (N - K) * Y
# K泊より少ない場合は泊数に単価X円を掛ける
else:
    total_price = N * X

print(total_price)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# 入力
n, k, x, y = map(int, input().split())

# 処理
first_stay = k * x
second_stay = (n - k) * y

total_price = first_stay + second_stay

# 出力
print(total_price)

Submission status: Runtime Error

Solution code:
n, k, x, y = map(int, input().split())

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    K = int(readline())
    X = int(readline())
    Y = int(readline())
    if N <= K:
        ans = X * N
    else:
        ans = X * k + Y * (N - K)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    K = int(readline())
    X = int(readline())
    Y = int(readline())
    if N<=K:
        ans = X*N
    else:
        ans += X*k + Y*(N-K)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
input = list(map(int,input().split()))
print(int(input[1]*input[2] + (input[0]-input[1])*input[3]))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
n,k,x,y = map(int,sys.stdio.read().split())
high=n-k
ans=0
if high > 0:
  ans=x*k+high*y
else:
  ans=n*x
print(ans)

Submission status: Runtime Error

Solution code:
ab, bc, ca = map(int, input().rstrip().split())
print(ab*bc//2)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(1,a+1):
  if i >= b+1:
    e += d
    else:
      e += c
      print(e)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import itertools

n,a = map(int,input().split())
x = list(map(int, input().split()))

cnt = 0

for i in range(n+1):
    for v in itertools.combinations(x,i+1):
        if sum(v) == a*(i+1): #組み合わせのカードの平均がaと等しいならば
            cnt = cnt + 1

print(cnt)

Submission status: Runtime Error

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

f_normal = x * k
f_addition = f_formal + (n - k) * y

if n <= k:
  print(f_normal)
else:
  print(f_addition)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
hotel=int(input())
hotel2=int(input())
hotel3=int(input())
hotel4=int(input())

sum1=int(hotel)*int(hotel2)
sum2=int(hotel39*int(hotel4)
fee=int(sum1)+int(sum1)

print(str(fee))

Submission status: Runtime Error

Solution code:
N = int(input())
K = int(input())
price = int(input())
d_price = int(input())
if K >= N:
    total = N * prive
    print(total)
else:
    total = K * price
    N -= K
    total += N * d_price
    print(total)

Submission status: Runtime Error

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

price = 0

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

print(price)

Submission status: Runtime Error

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: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

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: Runtime Error

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: Runtime Error

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 - x) * y)

Submission status: Runtime Error

Solution code:
lis = [int(input()) for _ in range(3)]

print(lis[1]*lis[2] + (lis[0]-lis[1])*lis[3])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
stay = int(input())
change_day = int(input())
first_cost = int(input())
change_cost = int(input())
total_cost = 0

for i in range(stay):
 if(i < change_day):
 total_cost += first_cost
else:
 total_cost += change_cost

print(total_cost)

Submission status: Runtime Error

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: Runtime Error

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

AC=0

if N > K:
    for _ in range(K):
        AC += X
    
    for _ in range(N-K):
        AC += Y

    print(AC)

else:
    for _ in range(K):
        AC += X
        print(AC)

Submission status: Runtime Error

Solution code:
def takahashi(n, k, x, y):
    if n > k:
        return (n-k+1)*x + (k-1)*y
    else:
        return n*x
    


n,k,x,y = list(map(int, input().split()))
takahashi(n,k,x,y)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,A=map(int,input().split())
cards=list(map(int,input().split()))

result=0

for i in range(2**N):
    list2 =[]
    for j in range(N):
        if (i >> j) &1 == 1:
            list2.append(cards[j])
    if len(list2)!=0:
        ave =sum(list2)/len(list2)
        if ave==A:
            result+=1

print(result)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(N)
print(K)
print(X)
print(Y)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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: Runtime Error

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

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

print(fee)

Submission status: Runtime Error

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

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

print(fee)

Submission status: Runtime Error

Solution code:
var = [int(e) for e in input().split()]
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: Runtime Error

Solution code:
var = [int(e) for e in input().split()]
n = var[0]
k = var[1]
x = var[2]
y = var[3]
if n>k:
    print(k*x+(n-k)*y)
else:
    print(k*x)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
#ABC044.A
N,K,X,Y = map(int,input().split())
#N<=Kの時
if N <= K:
    total_1 = N*X
    print(total_1)
#N>Kの時
else:
    total_2 = K*X + (N-K)*Y
    print(total_2)

Submission status: Runtime Error

Solution code:
s = input()

counter = [0] * 26

for i in s:
    counter[ord(i)-97] += 1

flag = 'Yes'
for i in counter:
    if (i % 2) == 1:
        flag = 'No'

print(flag)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
import sys
sys.setrecursionlimit(10000000)

n = int(input())
s = int(input())

up = math.sqrt(n)

def colsum(num, base):
    if num < base:
        return num
    else:
        return num%base + colsum(num//base,base)

#s = n(n<b)
if s == n:
    print(n+1)
    exit()


#sqrt(n)まで探索
for i in range(2,int(up)+1):
    if s == colsum(n,i):
        print(i)
        exit()

#2桁しかあり得ない場合(sqrt(n)<b<n)
for j in range(1,int(up)+1):
    if (n-s)%j == 0:
        b = (n-s)/j + 1
        if s == colsum(n,b) and b > 1:
            print(i)
            exit()

print(-1)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n = list(input())
ans = 'Yes'
 for i in w:
	if int(w.count(i))%2 == 1:
		ans = 'No'
		break
	if int(w.count(i))%2 == 0:
		continue
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,k,x,y=int(input().strip().split(' '))
if n<k+1 :
    print(n*x)
elif n>k :
    print((n-k)*y+k*x)

Submission status: Runtime Error

Solution code:
n,k,x,y=int(input().strip().split(' '))
if n<=k :
    print(n*x)
elif n>k :
    print((n-k)*y+k*x)

Submission status: Runtime Error

Solution code:
N,A = map(int,input().split())
X = list(map(int,input().split()))
ans = 0

def make_array(dims,fill):
    if len(dims) == 1:
        return [fill]*dims[0]
    ret = []
    nxt = dims[1:]
    for i in range(dims[0]):
        ret.append(make_array(nxt,fill))
    return ret
S = sum(X)+1
dp = make_array([N+2,N+2,S],0)
dp[0][0][0] = 1
for i in range(N):
    for j in range(N):
        for s in range(S-X[i]):
            dp[i+1][j+1][s+X[i]] += dp[i][j][s]
            dp[i+1][j][s] += dp[i][j][s]
ans = 0
for j in range(1,N+1):
    for s in range(1,S+1):
        if j*A == s:
            ans += dp[-2][j][s]
print(ans)

Submission status: Runtime Error

Solution code:
s = list(map(int,input().split()))

if s[0] <= s[1]:
    print(s[0]*s[2])
else:
    atamakin = s[1]*s[2]
    nokori = (s[0]-s[1])*s[3]
    print(atamakin + nokori)

Submission status: Runtime Error

Solution code:
s = list(map(int,input().split()))

if s[0] < s[1]:
    print(s[0]*s[2])
else:
    atamakin = s[1]*s[2]
    nokori = (s[0]-s[1])*s[3]
    print(atamakin + nokori)

Submission status: Runtime Error

Solution code:
a,b,c,d=[int(input()) for i in [0]*4]
print(n,k,x,y=(int(input()) for i in [0]*4))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N, K, X, Y = map(int, input().split())
total = K*X + (N-K)*Y
print(total)

Submission status: Runtime Error

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

before = input()
after = input()


result = K*before + (N-K)*after

print(result)

Submission status: Runtime Error

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

befoer = input()
after = input()

result = K*befoer + (N-K)*after

print(result)

Submission status: Runtime Error

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: Runtime Error

Solution code:
want = input().int()
due = input().int()
start = input().int()
over = input().int()
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)