import Control.Monad
import Text.Printf
import Control.Applicative
import Data.List as L

getInts :: IO [Int]
getInts = map read . words <$> getLine

main :: IO()
main = do
  [a, b, c] <- map read . words <$> getLine
  [k] <- map read . words <$> getLine
  printf "%d" $ slv a b c k

slv :: Integer -> Integer -> Integer -> Integer -> Integer
slv a b c k = sumabc - maximumabc + maximumabc * 2^k
  where sumabc = a + b + c
        maximumabc = maximum [a, b, c]