private fun readInts() = readLine()!!.split(" ").map { it.toInt() }

fun main(args: Array<String>) {
    val (a, b, c) = readInts()
    val (N) = readInts()

    val max = listOf(a, b, c).max()!!

    println((a + b + c + max * Math.pow(2.0, N.toDouble()) - max).toInt())
}