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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc044/tasks/abc044_a

"""
import sys
from sys import stdin
input = stdin.readline


def solve(N, K, X, Y):
    total = 0
    if N > K:
        total += X * K
        total += Y * (N - K)
    else:
        total += X * N
    return total


def main(args):
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())
    ans = solve(N, K, X, Y)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-



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

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

if __name__ == "__main__": main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
sum = 0
if N <= K:
    for i in range(0,N):
        sum = sum + X
if N >= K + 1:
    for i in range(0,K):
        sum = sum + X
    for i in range(K,N):
        sum = sum + Y
print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

K = int(input())

X = int(input())

Y = int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())
    
    total = 0
    for x in range(1, N + 1):
        if x <= K:
            total += X
        else:
            total += Y

    print(total)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

num = 0

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

print(num)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math
import sys
import itertools
import numpy as np
import functools
import collections
mo = 1000000007
INF = 10**100
r = range

class infix(object):
    def __init__(self, function):
        self.function = function

    def __ror__(self, other):
        self.left = other
        return self

    def __or__(self, other):
        return self.function(self.left, other)

    def __call__(self, value1, value2):
        return self.function(value1, value2)

@infix
def c(f_t_u, f_u_r): return lambda t: f_u_r(f_t_u(t))

class _Ap(object):
    def __rlshift__(self, other):
        self.value = other
        return self

    def __rshift__(self, other):
        return other(self.value)
Ap = _Ap()
ap = Ap

#d = {1:2, 3:5, 6:10, 1000043:3814}
#zip(d.keys(), d.values())<<ap>>(list |c| sorted |c| reversed |c| list |c| print)



n = input()<<ap>>(int)
k = input()<<ap>>(int)
x = input()<<ap>>(int)
y = input()<<ap>>(int)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stdin, stdout
def readLine_int_list():return list(map(int, stdin.readline().split()))
def readLine_int_list_reverse(): return list(map(int, stdin.readline().split())).reverse()
def readAll_int(): return list(map(int, stdin))
def readLine_str_list():return list(map(str, stdin.readline().split()))
def readAll_str(): return list(map(str, stdin))
def readLine_int_set(): return set(list(map(int, stdin.readline().split())))
def g_twoD_list(p,q): return [[0 for i in range(p)] for j in range(q)]


def main():
    n,k,x,y = readAll_int()
    print(k*x + (n-k)*y if n-k > 0 else n*x)
    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

print(res)

Submission status: Accepted

Solution code:

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

O = max(0, N - K) # over
P = N - O         #

res = P * X + O * Y

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import defaultdict


def main():
    N, K, X, Y = int(input()), int(input()), int(input()), int(input())
    ans = 0
    for i in range(N):
        ans += X if i < K else Y
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

A=0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def ini(): return int(input())
def inli(): return list(map(int, input().split()))
def inf(): return float(input())
def inlf(): return list(map(float, input().split()))
def inl(): return list(input())
def pli(): return "".join(list(map(str, ans)))

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def ris(): return list(input())
def pli(): return "".join(list(map(str, ans)))

N = ri()
K = ri()
X = ri()
Y = ri()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

    print(cost)

main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding:utf-8
import os, sys
import math

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
#coding:utf-8

def input_strs():
    return input().split(" ")

def input_nums():
    return [int(i) for i in input_strs()]


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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    N = int(input())
    K = int(input())
    x = int(input())
    y = int(input())

    ans = x * min(N, K) + y * max(N - K, 0)

    print(ans)

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8;

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7


def main():
    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())
    r = x * min(n,k)
    r += y * max(0,n-k)
    return r



print(main())

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

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

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

print(main())

Submission status: Accepted

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 = n*x
print(ans)

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 宿泊数
N = int(input())
# 通常料金期間
K = int(input())
# 通常料金X
X = int(input())
# 割引料金Y
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 + (N - min(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(N):
    if((i+1)<=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())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created: 火 11/ 8 16:49:06 2016

# Usage
#
"""
def read_input():
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())

    return N, K, X, Y


def check_sum(N, K, X, Y):
    """
    >>> check_sum(5, 3, 10000, 9000)
    48000
    >>> check_sum(2, 3, 10000, 9000)
    20000
    """
    if N > K:
        return K * X + (N-K)*Y
    else:
        return N * X


if __name__ == "__main__":
    # import doctest
    #
    # doctest.testmod()
    N, K, X, Y = read_input()

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

Submission status: Accepted

Solution code:
# coding: UTF8

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def read():
    return int(input())

def reads(sep=None):
    return list(map(int, input().split(sep)))

def main():
    n, k, x, y = [read() for _ in range(4)]
    print(min(k, n)*x + max(0,n-k)*y)

main()

Submission status: Accepted

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

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if put[0] < put[1]:
	print(put[2] * put[0])
else:
	print(put[2] * put[1] + put[3] * (put[0] - put[1]))

Submission status: Accepted

Solution code:
# coding: utf-8
# Here your code !

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

print ret

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

Submission status: Accepted

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

n = input()
k = input()
x = input()
y = input()
print a(n, k, x, y)

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

Submission status: Accepted

Solution code:
N,K,X,Y =int(input()),int(input()),int(input()),int(input())
ans=0
for s in range(N):
	if s>=K:
		ans+=Y
	else:	ans+=X
print(ans)

Submission status: Accepted

Solution code:
a = input()
b = input()
c = input()
d = input()
e = 0
for i in range(a):
	if i <= b-1:
		e += c
	else:
		e += d

print e

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

N = input_list[0]
K = input_list[1]
X = input_list[2]
Y = input_list[3]

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

print ( result )

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC044A

n=int(raw_input())
k=int(raw_input())
x=int(raw_input())
y=int(raw_input())
if n<=k:
 res=x*n
elif n>k:
 res=x*k+(n-k)*y
print res

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:
if __name__ == '__main__':
    N = input()
    K = input()
    X = input()
    Y = input()
    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()

ix = min(K, N)
iy = max(0, N-K)

payment = ix * X + iy * Y
print payment#, ix, iy

Submission status: Accepted

Solution code:
n = input()
k = input()
print input()*n if n<=k else input()*k+input()*(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 += 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,k,x,y = [int(input()) for _ in range(4)]
print(str(sum([x if z<k else y for z in range(n)])))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python

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

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

Submission status: Accepted

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