A,B=map(int,input().split()) C=0 if B: while B>1:A,B,C=C-A,B-1,-A else:A,C=C,A print(A,C)