main :: IO ()
main = do
    [a, b, c] <- map (read :: String -> Int) . words <$> getLine
    [k] <- map (read :: String -> Int) . words <$> getLine
    let m = maximum [a, b, c]
        s = sum [a, b, c]
    print $ s + m * (2^k - 1)