import java.util.Scanner

fun main(args: Array<String>){
    val scanner = Scanner(System.`in`)
    var nums: Array<Int?> = arrayOfNulls(3)
    for (i in 0 until 3){
        nums[i] = scanner.nextInt()
    }
    nums.sort()
    val K = scanner.nextInt()
    for (j in 0 until K){
        nums[2] = nums[2]?.times(2)
    }
    println(nums[0]!! + nums[1]!! + nums[2]!!)
}