a,b,c,k = list(map(int,input().split()))

if k % 2 == 0:

    print((a-b))

else:

    print((b-a))
a,b,c,k = list(map(int,input().split()))

print(((a-b)*(-1)**(k%2)))

a, b, c, k = list(map(int, input().split()))
if k % 2 == 0:
    print((a - b))
else:
    print((b - a))

a, b, c, k = list(map(int, input().split()))
print(((a - b) * (-1) ** (k % 2)))

-if k % 2 == 0: -    print((a - b)) -else: -    print((b - a)) +print(((a - b) * (-1) ** (k % 2)))