module Main where

import Control.Applicative

main :: IO ()
main = do
    [n, k, x, y] <- map read . lines <$> getContents
    let a = if n >= k then k else n
        b = if n >= k then n - k else 0
    print $ a * x + b * y
