object Main extends App{
val in= io.StdIn.readLine.split(' ').map(_.toInt).toSeq
val A=in(0)  
val B=in(1)  
val K=in(2)  

def func1(a:Int, b:Int, k:Int):(Int,Int)={
//println(a, b, k)
if(k==0) (a, b) else func2(a/2, b+ a/2, k-1)
}
def func2(a:Int, b:Int, k:Int):(Int,Int)={
//println(a, b, k)
if(k==0) (a, b) else func1(a + b/2, b/2, k-1)
}
val ret=func1(A, B, K)
println(ret._1 +" "+ ret._2)
}
