strToInt :: String -> Int
strToInt x = read x :: Int

leadAns :: Int -> Int -> Int -> Int -> Int
leadAns n k x y 
    | n==1 = x
    | n > k = y + leadAns (n-1) k x y
    | otherwise = x + leadAns (n-1) k x y

main = do
    inn <- getLine
    ink <- getLine
    inx <- getLine
    iny <- getLine
    let n = read inn :: Int
        k = read ink :: Int
        x = read inx :: Int
        y = read iny :: Int
    putStrLn $ show $ leadAns n k x y
    