fun main(arr: Array<String>) {
    val inpt = readLine()!!.split(" ").map { it.toLong() }
    var ab = inpt.take(2).toMutableList()
    val k = inpt[2].toInt()
    for(i in (0 until k)) {
        val idx1 = i%2
        val idx2 = (idx1+1)%2

        if(ab[idx1]%2!=0L) {
            ab[idx1]--
        }
        ab[idx2] += ab[idx1]/2
        ab[idx1] = ab[idx1]/2
    }
    println(ab.joinToString(" "))
}
