A,B=map(int,input().split())
if B%3==0:print(0,A)
elif B%3==1:print(A,0)
else:print(-A,-A)