def main(): f0, f1, n = map(int, input().split()) for i in range(n): f0, f1 = f1, f0 ^ f1 print(f0) if __name__ == '__main__': main()