import Data.List

maxmumSum zs k = a * (2 ^ k) + b + c
    where
        [a,b,c] = reverse . sort $ zs

main = do
    zs <- map read . words <$> getLine
    k <- read <$> getLine
    print $ maxmumSum zs k