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

Solution code:
import java.util.Scanner;
 
class Main{
  public static void main(String[] args){
    Scanner sin = new Scanner(System.in);
    int N = sin.nextInt();
    int K = sin.nextInt();
    int X = sin.nextInt();
    int Y = sin.nextInt();
    
    if(N<=K){
      int rent = X*N;
      System.out.println(rent);
    }else{
      int lent = N-K;
      int lent2 = X*K + lent*Y;
      System.out.println(lent2);
    }
  }  
}

Submission status: Runtime Error

Solution code:
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sin = new Scanner(System.in);
    int N = sin.nextInt();
    int K = sin.nextInt();
    int X = sin.nextInt();
    int Y = sin.nextInt();
    
    if(N<=K){
      int rent = X*N;
      System.out.println(rent);
    }else{
      int lent = N-K;
      System.out.println(lent);
    }
  }  
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import itertools
kai,av=[int(x) for x in input().rstrip().split()]
l=[int(x) for x in input().rstrip().split()]
ll=[i for i in range(1,kai+1)]
result=[]
count=0
 
 
for i in ll:
    for j in itertools.combinations(l,r=i):
        if av==(sum(j)/i):
            count+=1
print(count)

Submission status: Runtime Error

Solution code:
[N,K,X,Y] = list( int, input().split() )

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a=input().split
int(a)
N=a(0) 
K=a(1)
X=a(2)
Y=a(3)
if N > K:
  tot = K*X+(N-K)*Y
else:
  tot = N*X
print(tot)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
//	cin>>n>>k;
//	cout<<n<<k<<endl;
//string S[100];

int main(){
	int N,K,X,Y;cin>>N>>K>>X>>Y;
	int ans;

	for(int i=1;i<N+1;i++){
		if(K<i){
			ans+=Y;

		}else{
			ans+=X;
		}
	}
	cout<<ans<<endl;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

# N泊連続で行う。最初の K 泊まで X 円.　K+1泊以降はY円

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

Submission status: Runtime Error

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

D = (N-K)*X + (N-(K+1))*Y 

# N泊連続で行う。最初の K 泊まで X 円.　K+1泊以降はY円

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


#　10泊する　5泊目までX円　6泊目からY円　(((N-K)*X) + ()

Submission status: Runtime Error

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

if N <= K:
    print(N * K)
else:
    S = N * K
    s = N * (N - K)
    S += s
    print(S)

Submission status: Runtime Error

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

a = 0 if N<K else N-k
cost = X*K + Y*a

print(cost)

Submission status: Runtime Error

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

print(answer)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

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

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

else:
  print(k*x)

Submission status: Runtime Error

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

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

else:
  print(k*x)

Submission status: Runtime Error

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

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

else:
  print(round(k*x))

Submission status: Runtime Error

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

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

else:
  print(round(k*x))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
 -*- coding: utf-8 -*-
# 整数の入力
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: Runtime Error

Solution code:
def solve():
    def recur(i, n, total):
        # print("i, n, total", i, n, total)

        if not TABLE[i][n][total] == -1:
            # print('cache!')
            return TABLE[i][n][total]

        if not i < N:
            if n > 0 and total == A * n:
                return 1
            return 0

        ans1 = recur(i + 1, n, total)
        ans2 = recur(i + 1, n + 1, total + XS[i])

        # print(ans1, ans2)

        TABLE[i][n][total] = ans1 + ans2
        return TABLE[i][n][total]

    N, A = tuple(map(int, input().split()))
    XS = tuple(map(int, input().split()))

    TABLE = []
    for _ in range(N + 1):
        lines = [[-1 for x in range(N * 50 + 1)] for y in range(N + 1)]
        TABLE.append(lines)

    return recur(0, 0, 0)


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

Submission status: Runtime Error

Solution code:
def solve():
    def recur(i, n, total):
        # print("i, n, total", i, n, total)

        if not TABLE[i][n][total] == -1:
            # print('cache!')
            return TABLE[i][n][total]

        if not i < N:
            if n > 0 and total == A * n:
                TABLE[i][n][total] = 1
                return 1
            TABLE[i][n][total] = 0
            return 0

        ans1 = recur(i + 1, n, total)
        ans2 = recur(i + 1, n + 1, total + XS[i])

        # print(ans1, ans2)

        return ans1 + ans2

    N, A = tuple(map(int, input().split()))
    XS = tuple(map(int, input().split()))

    TABLE = []
    for _ in range(N + 1):
        lines = [[-1 for x in range(N * 50 + 1)] for y in range(N + 1)]
        TABLE.append(lines)

    return recur(0, 0, 0)


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

Submission status: Runtime Error

Solution code:
import collections

# N, K = map(int, input().split())
# A = list(map(int, input().split()))
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: Runtime Error

Solution code:
    import collections

    # N, K = map(int, input().split())
    # A = list(map(int, input().split()))
    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: Runtime Error

Solution code:
n,k,x,y=[int(input()) for_ in range(4)]
print(min(n, k)*x+max(n-k,0)*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,K,X,Y=map(int,input().split())
cost=K*X+(N-K)*Y
print(cost)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N, K, X, Y = (int(input().split()) for _ in range(4))
t = 0
if N >= K:
    print(X*K + Y*(N-K))
else:
    print(X*N)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, k, x, y = int(input().split()) for _ in range(4)
print(k * x + (k - n) * y)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, k, x, y = int(input().split()) for _ in range(4)
print(k * x + (n - k) * y)

Submission status: Runtime Error

Solution code:
n, k, x, y = int(input.split()) for _ in range(4)
print(k * x + (n - k) * y)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = input()
k = input()
x = input()
y = input()
print(k*(x-y)+n*y)

Submission status: Runtime Error

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

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

print(S)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

acc = 0

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

print(acc)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
for _ in range(4):
	N,K,X,Y=int(input())

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

Submission status: Runtime Error

Solution code:
import sys

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

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

Submission status: Runtime Error

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
for _ in range(4):
	N,K,X,Y=int(input())
	
print(N*X-(max((N-K),0)*(X-Y))

Submission status: Runtime Error

Solution code:
n,k,x,y = list(map(int,input().split()))
print(n*x+(y-x)*max(n-k,0))

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

Submission status: Runtime Error

Solution code:
stay = int(input())
plan_change_day =int(input())
high_price=int(input())
low_price=int(input())
 
def main():
	if stay - plan_change_day > 0:
		cost = high_price * plan_change_day + low_price * (stay - plan_change_day)
        print(int(cost))
    else:
        cost = high_price * plan_change_day 
  	    print(int(cost))
  	    
main()

Submission status: Runtime Error

Solution code:
stay = int(input())
plan_change_day =int(input())
high_price=input()
low_price=input()

def main():
  cost = high_price * plan_change_day + low_price * (stay - plan_change_day)
  print(cost)
  
 main()

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

sol = x * k + (n - k) * y

if n - k < 0:
    sol = x * k

print(sol)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

total = 0
for a in range(1, N+1): #6 , 1, 2, 3, 4, 5
	if a < K:
		total += X
    else:
		total += Y

print(total)

Submission status: Runtime Error

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

total = 0
for a in range(1, N+1): #6 , 1, 2, 3, 4, 5
	if a < K:
      total += X
    else:
      total += Y

print(total)

Submission status: Runtime Error

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

total = 0
for a in range(1, 6): #6 , 1, 2, 3, 4, 5
	if a <= K:
      total += X
    else:
      total += Y

print(total)

Submission status: Runtime Error

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

total = 0
for a in range(1, 6): #6 , 1, 2, 3, 4, 5
	if a < K:
      total += X
    else:
      total += Y

print(total)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a,b,c,d=[int(input) for i in range(4)]
print(a*c-(c-d)*max(b-a,0))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
w = input()
for i in range(len(w)):
    if w.count(w[i])%2 == 1:
        print("No")
        exit(1)

print("Yes")

Submission status: Runtime Error

Solution code:
w = input()
for i in set(w):
    if w.count(i)%2 == 1:
        print("No")
        exit(1)

print("Yes")

Submission status: Runtime Error

Solution code:
w = input()
for i in set(w):
    if w.count(i)%2 == 1:
        print("No")
        exit(-1)

print("Yes")

Submission status: Runtime Error

Solution code:
w = input()
for i in set(w):
    if w.count(i)%2 == 1:
#print("No")


print("Yes")

Submission status: Runtime Error

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

total_price = ((k * X) + ((N - K) * Y))
print(total_price)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import sys, math, fractions, itertools

def solve(N: int, A: int, x: "List[int]"):
    X = max(x)
    dp = [[[0 for _ in range(max(N*X+1, N*A+1))] for _ in range(N+1) ] for _ in range(N+1)]
    dp[0][0][0] = 1
    for n in range(N+1):
        for m in range(N+1):
            for k in range(N*X+1):
                if n >= 1 and k < x[n-1]:
                    dp[n][m][k] = dp[n-1][m][k]
                elif n >= 1 and m >= 1 and k >= x[n-1]:
                    dp[n][m][k] = dp[n-1][m][k] + dp[n-1][m-1][k-x[n-1]]
    s = 0
    for i in range(1, N+1):
        s += dp[N][i][i*A]
    print(s)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    x = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A, x)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys
 
nN = int(input())
nK = int(input())
nX = int(input())
nY = int(input())
 
nE = 0
nANs = 0
 
if nN =< nK:
  nAns = nX * nN
  print(nAns)
  sys.exit()
  
nE = nN - nK
 
nAns = nX * nN + nY * nE
print(nAns)

Submission status: Runtime Error

Solution code:
inport numpy as np
n, k, x, y = map(int, input().split('\n'))
basic = np.min(k * x, n * x)
plus = np.max((n - k) * y, 0)
print(basic + plus)

Submission status: Runtime Error

Solution code:
n, k, x, y = map(int, input().split('\n'))
basic = min(k * x, n * x)
plus = max((n - k) * y, 0)
print(basic + plus)

Submission status: Runtime Error

Solution code:
import sys

nN = int(input())
nK = int(input())
nX = int(input())
nY = int(input())

nE = 0

if nN =< nK:
  nAns = nX * nN
  print(nAns)
  sys.exit()
  
nE = nN - nK

nAns = nX * nN + nY * nE
print(nAns)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n = input()
k = input()
x = input()
y = input()
print(k*x + (n-k)*y)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
nums = list(map(int,input().split()))
N = int(nums[0])
K = int(nums[1])
X = int(nums[2])
Y = int(nums[3])

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

if a[0] > a[1]:
  print(a[3]*a[1]+a[4]*(a[2]-a[1]))
else:
  print(a[3]*a[1])

Submission status: Runtime Error

Solution code:
import numpy as np
N, A = map(int, input().split())
x = list(map(int, input().split()))

X = max(x)
if X < A:
    X = A

def check(j, k, s):
    if dp[j][k][s] != -1:
        return dp[j][k][s]
    if j == 0 and k == 0 and s == 0:
        dp[j][k][s] = 1
        return 1
    if j >= 1 and s < x[j-1]:
        a = check(j-1, k ,s)
        dp[j][k][s] = a
        return a
    if j >= 1 and k >= 1 and s >= x[j-1]:
        a = check(j-1, k, s) + check(j-1, k-1, s-x[j-1])
        dp[j][k][s] = a
        return a
    dp[j][k][s] = 0
    return 0
        
dp = [[[-1] * (N*X+1) for _ in range(N+1)] for _ in range(N + 1)]
dp = np.array(dp)
# print (dp)
# for j in range(N+1):
#     for k in range(N+1):
#         for s in range(N*X + 1):
#             print (j, k, s)
#             dp[j][k][s] = check(j, k, s)

ans = 0
for k in range(1, N+1):
    ans += check(N, k, k * A)
    # ans += dp[N][k][k * A]

print (ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l = [int(input()) for i 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: Runtime Error

Solution code:
l = [int(input) for i 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: Runtime Error

Solution code:
l = list(map(int, input().split()))
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: Runtime Error

Solution code:
l=list(map(int, input().split()))
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: Runtime Error

Solution code:
l=list(map(int, input.split()))
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: Runtime Error

Solution code:
n=int(inpyt())
k=int(inpyt())
sp_p=int(inpyt())
n_p=int(inpyt())
sum = 0

for i in k:
    sum += sp_p

for j in n-k:
    sum += n_p

print(sum)

Submission status: Runtime Error

Solution code:
n, k, sp_p, n_p = map(int, input().split())
sum = 0

for i in k:
    sum += sp_p

for j in n-k:
    sum += n_p

print(sum)

Submission status: Runtime Error

Solution code:
n, k, sp_p, n_p = map(int, input().split())
sum = 0

for i in k+1:
    sum += sp_p

for j in n-k+1:
    sum += n_p

print(sum)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

if n > k:
  print(int(k*10000+(n-k)*9000))
else:  
  print(int(n*10000)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
words = input()
lett = list(words)
numlist = []
for i in lett:
    num = lett.count(i)
    numlist += [num]
jud = []
for i in numlist:
    if i%2 == 0:
        jud += ['Yes']
    else:
        jud += ['No']

anslist = [x for x in set(jud) if jud.count(x) > 1]

ans = anslist[0]

print(ans)

Submission status: Runtime Error

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*

Submission status: Runtime Error

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

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

print(result)

Submission status: Runtime Error

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

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

print(result)

Submission status: Runtime Error

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

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

print(result)

Submission status: Runtime Error

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

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

print(result)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

print(ans)

Submission status: Runtime Error

Solution code:
n = input()
ini = input()
ini_pri=input()
left_pri=input()

ans = 0
for i in range(n):
  	if i < ini:
      ans += ini_pri
    else:
      ans += left_pri

print(ans)

Submission status: Runtime Error

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