main :: IO()
main = do
    ls <- map read . words <$> getLine
    k <- readLn
    print $ getsolve ls k
    
getsolve :: [Int] -> Int -> Int
getsolve ls k = withoutsum + ( maxnum * (2 ^ k))
                    where maxnum = maximum ls
                          withoutsum = sum ls - maxnum