import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  
  solve <$> replicateM 4 (getl toInt) >>= print

solve :: [Int] -> Int
solve [n,k,x,y] 
  | n > k = k * x + (n-k) * y
  | otherwise = n * x

toInt :: String -> Int
toInt = read

getl :: (String -> a) -> IO a
getl f = f <$> getLine
