abc096b = do
    [a,b,c] <- readArray getLine
    n <- readLn::IO Int
    print $ sum[a,b,c] + maximum [a,b,c] * (pow2 n 1 -1)
        where pow2 0 mul = mul
              pow2 x mul = 2 * pow2 (x-1) mul

main = abc096b

readArray::IO String -> IO[Int]
readArray = fmap $ map read . words