import Data.List
import Control.Monad

day :: [String]
day = ["SUN", "MON", "TUE", "WED", "WED", "THU", "FRI", "SAT"]

main = print =<< ((pure calc) <*> getInts)

getInt :: IO Int 
getInt = (pure read) <*> getLine

getInts :: IO [Int]
getInts = replicateM 4 getInt

getx :: [Int] -> Int
getx [n, k, x, _] = (*) x $ min n k

gety :: [Int] -> Int
gety [n, k, _, y] = (*) y $ max 0 $ n - k

calc :: [Int] -> Int
calc val = (getx val) + (gety val)
