a, b = map(int, input().split()) b %= 3 if b == 2: print(-a, -a) elif b == 1: print(a, 0) else: print(0, a)