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