F0, F1, N = map(int, input().split()) a, b = F0, F1 for i in range(2, N + 1): t = b ^ a a = b b = t print(b)