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

Solution (Python):

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

Solution (Python):
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

Solution (Python):
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)

Solution (Python):

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

Solution (Python):
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)

Solution (Python):
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()

Solution (Python):
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)

Solution (Python):
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

Solution (Python):
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)

Solution (Python):

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)

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

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):




"""








"""
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__":
    
    
    
    N, K, X, Y = read_input()

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

Solution (Python):


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)

Solution (Python):
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)

Solution (Python):
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

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

Solution (Python):
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))

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

Solution (Python):
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)

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

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

Solution (Python):

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)

Solution (Python):
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()

Solution (Python):
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()

Solution (Python):
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)

Solution (Python):
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()

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

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

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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

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

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

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

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

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

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

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

Solution (Python):
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]))

Solution (Python):



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)

Solution (Python):
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)

Solution (Python):
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

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

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

print ret

Solution (Python):
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)

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

Solution (Python):
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)

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

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

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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

Solution (Python):
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

Solution (Python):
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))

Solution (Python):
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 )

Solution (Python):


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)

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

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

Solution (Python):
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))

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

Solution (Python):
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)

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

Solution (Python):


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

Solution (Python):
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)

Solution (Python):
if __name__ == '__main__':
    N = input()
    K = input()
    X = input()
    Y = input()
    if(N <= K):
        print (N * X)
    else :
        print (K * X) + ((N-K) * Y)

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

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

payment = ix * X + iy * Y
print payment

Solution (Python):
n = input()
k = input()
print input()*n if n<=k else input()*k+input()*(n-k)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
n,k,x,y = [int(input()) for _ in range(4)]
print(str(sum([x if z<k else y for z in range(n)])))

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

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

Solution (Python):
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

Solution (Python):
from Queue import * 
from bisect import * 
from collections import * 

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

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

Solution (Python):


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

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

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

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

Solution (Python):
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)

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

Solution (Python):
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)

Solution (Python):
'''
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)

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

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

print(res)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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

Solution (Python):

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

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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])

Solution (Python):
import sys 

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







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

Solution (Python):
import sys 

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







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

Solution (Python):

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)

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

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

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):

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

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

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

Solution (Python):
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)

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

Solution (Python):
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)

Solution (Python):
import re
import doctest


class IO_for_Contest(object):
    @staticmethod
    def my_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__':
    
    solve()

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

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

Solution (Python):
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)

Solution (Python):
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))

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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

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