A,B=map(int,input().split()) p=[0]*max(B+1,2) p[B]=A for i in reversed(range(2,B+1)): v=p[i] p[i-0]-=v p[i-1]-=v p[i-2]-=v print(p[1],p[0])