a,b,k=gets.split.map(&:to_i)
x=y=-1;
kk=k
while(k>0)
  k-=1
  a&=-2
  b += a >>= 1
  break if (a == x && b == y)
  x=a;y=b;
  t=a;a=b;b=t
end
if k == 0
  print [a,b][kk&1]," ",[a,b][~kk&1],"\n"
else
print [a,b][k&1]," ",[a,b][~k&1],"\n"
end


