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-----
5
3
10000
9000

-----Sample Output-----
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.

Difficulty: introductory

Starter code:

Solutions:

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)

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

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

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

print(sum)

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

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

import math
from datetime import date

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

main()


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

N,K,x,y = [int(input()) for i in range(4)]

if K<N:
  print((N-K)*y + K*x)
  
else:
  print(N*x)

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)

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)

a,b,c,d = [int(input()) for i in range(4)]
if a<b:
	print(a*c)
else:
	print((b*c) +((a-b) * d) )

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)

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

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

# 044_a
# A - 高橋君とホテルイージー

N = int(input())  # 連泊数
K = int(input())  # 料金変動泊数
X = int(input())  # 通常価格
Y = int(input())  # 変動価格

if ((1 <= N & N <= 10000) & (1 <= K & K <= 10000)) \
        & (1 <= X & X <= 10000) & (1 <= Y & Y <= 10000):
    if (X > Y):
        price = 0
        if (N < K):
            for i in range(1, N + 1):
                price += X
        if (N >= K):
            for i in range(1, K + 1):
                price += X
            for j in range(K + 1, N + 1):
                price += Y
        print(price)

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

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

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

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

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

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


n=int(input())
k=int(input())
x=int(input())
y=int(input())
first=min(n,k)
re=first*x
re+=max((n-first),0)*y
print(re)

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

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

    print(ans)



def __starting_point():
    main()

__starting_point()

# 最初のK泊までは、1泊あたりX円
# K+1泊目以降は、1泊あたりY円
# N泊したときの宿泊費

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

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)


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)

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)

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


# 数値の取得
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

# 宿泊費の計算後結果を出力
if N <= K:
  account = N * X
else:
  account = (K * X) + (max(N - K,0) * Y) 
  
print(account)

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

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

print(ans)

from sys import stdin
input = stdin.readline

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

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

print(cost)

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

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

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

"""
ABC044 A 高橋君とホテルイージー
https://kenkoooo.com/atcoder/#/table/Tsukumo
"""

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

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


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


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

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


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


def __starting_point():
    solve()

__starting_point()

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)

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

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


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)

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)

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)

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

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

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

# 入力
n = int(input())
k = int(input())
x = int(input())
y = int(input())

# 処理

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

print(answer)


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

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

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

if N >= 0:
  result += N * Y
print(result)

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

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

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



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


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

import sys
import math

#https://atcoder.jp/contests/agc008/submissions/15248942
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

N = ini()
K = ini()
X = ini()
Y = ini()

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


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

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

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

total=int(input()) #宿泊日数
disc=int(input()) #初めの割引なし日数
priceX=int(input()) #割引ない値段
priceY=int(input()) #割引後の値段

ans=()
if total<=disc:
  ans=total*priceX
else:
  ans=disc*priceX+(total-disc)*priceY
print(ans)

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

ans = 0

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

N = int(input())    # N泊
K = int(input())    # 最初のK泊までは1泊当たりX円
X = int(input())
Y = int(input())    # K+1泊目以降は1泊当たりY円

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

print(total)


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

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

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

import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    k = I()
    x = I()
    y = I()
    if n <= k:
        print(n*x)
    else:
        print(k*x + (n-k)*y)

def __starting_point():
    main()
__starting_point()

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

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


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)

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

#!/usr/bin/env python3

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


def __starting_point():
    main()

__starting_point()

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

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


n=int(input())
k=int(input())
x=int(input())
y=int(input())
fees=0
if(k>n or n==k):
	for i in range(0,n):
		fees+=x
elif(k<n):
	diff=n-k
	for j in range(0,k):
		fees+=x
	for k in range(0,diff):
		fees+=y
		
print(fees)


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

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)

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)

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

ans = min(n, k) * x
n -= min(n, k)

ans += n * y

print(ans)


n = int(input())
k = int(input())
x = int(input())
y = int(input())
cost = 0
if n > k:
    for i in range(k):
        cost += x

    for j in range(k, n):
        cost += y
    print(cost)

elif n <= k:
    for i in range(n):
        cost += x
    print(cost)




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

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

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

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

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)

class Combination:
    def __init__(self, n, mod):
        self.n = n
        self.mod = mod
        self.fac = [1 for i in range(self.n + 1)]
        self.finv = [1 for i in range(self.n + 1)]
        for i in range(2, self.n+1):
            self.fac[i] = (self.fac[i - 1] * i) % self.mod
            self.finv[i] = (self.finv[i-1] * pow(i, -1, self.mod)) % self.mod

    def comb(self, n, m):
        return self.fac[n] * (self.finv[n-m] * self.finv[m] % self.mod) % self.mod
def iparse():
    return list(map(int, input().split()))

def __starting_point():
    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())

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

__starting_point()

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

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

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

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

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


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)

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)

N = int(input())
K = int(input())
X = int(input())
Y = int(input())
price = 0
if N <= K:
  for i in range(N):
    price += X
  print(price)
else:
  for i in range(K):
    price += X
  for i in range(N-K):
    price += Y
  print(price)

import sys
from heapq import heappush, heappop, heapify
import math
from math import gcd
import itertools as it
from collections import deque 

input = sys.stdin.readline

def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))

INF = 1001001001

# ---------------------------------------

def main():
    n = inp()
    k = inp()
    x = inp()
    y = inp()
    if n > k:
        print((x * k + y * (n - k)))
    else:
        print((x * n))

main()


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

L = [int(input()) for _ in range(4)]
print(L[2]*min(L[0],L[1])+L[3]*max(0,L[0]-L[1]))

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

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

def iroha():
    n, k, price, special = [int(input()) for i in range(4)]
    result = 0
    for i in range(n):
        if i < k:
            result += price
        else:
            result += special
    print(result)

def __starting_point():
    iroha()

__starting_point()

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

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

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

import sys
N, K, X, Y = map(int, sys.stdin.readlines())
print(N*X if N <= K else K*X +Y*(N-K))

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

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

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

N=int(input())
K=int(input())
X=int(input())
Y=int(input())
#print(type(N))

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


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)

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


total = int(input())
initial = int(input())
if initial > total:
  initial = total
a = int(input())
b = int(input())
count = 0
for i in range(initial):
  count+= a
for c in range(total - initial):
  count+=b

print(count)


from sys import stdin
input = stdin.readline

n, k, x, y = list(map(int, stdin.read().split()))

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


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


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)