main :: IO()
main = do
  l1 <- getLine
  str <- getLine
  putStrLn $ solve l1 str

solve :: String -> String -> String
solve l1 str = show.snd $ foldl tr (x,0) xs
  where
    _:a:b:_ = map read $ words l1
    x:xs = map read $ words str
    tr :: (Int, Int) -> Int -> (Int, Int)
    tr (x, c) dest = (dest, c + min b ((dest - x) * a))
