using System; using System.Collections.Generic; using System.Linq; namespace Test { class Program { static void Main(string[] args) { long[] x = Console.ReadLine().Split().Select(long.Parse).ToArray(); switch (x[2] % 3) { case (0): { Console.WriteLine(x[0]); break; } case (1): { Console.WriteLine(x[1]); break; } case (2): { Console.WriteLine(x[0] ^ x[1]); break; } } } } }