def main(): f_0, f_1, n = [int(i) for i in input().split()] a = f_0 b = f_1 for i in range(2, n + 1): c = a ^ b a = b b = c print(c) if __name__ == "__main__": main()