import Data.List

main = do
    xs <- sort . map read . words <$> getLine :: IO [Int]
    k <- readLn :: IO Int
    print $ if k /= 0 
               then 2 * k * last xs + sum (init xs)
               else sum xs
