import Control.Applicative
import Data.List

main = do
    [a,b,c] <- map read . words <$> getLine :: IO [Int]
    k <- readLn
    print $ solve a b c k

solve :: Int -> Int -> Int -> Int -> Int
solve a b c k = f*2^(k) + d + e
    where [d,e,f] = sort [a,b,c]