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