import Data.List

main = do
    xs <- map read . words <$> getLine :: IO [Int]
    n <- readLn :: IO Int
    print $ f xs n

f :: [Int] -> Int -> Int
f xs 0 = sum xs 
f xs n = f (init sorted ++ [2 * last sorted]) (n-1)
    where 
        sorted = sort xs