solve :: Int -> Int -> Int -> Int -> Int
solve a b c k = (a + b + c) + max * (2^k - 1)
  where max = maximum [a, b, c]

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