using System; namespace No64_XORFibonacciSequence { internal class Program { static void Main(string[] args) { string[] param = Console.ReadLine().Split(' '); long f0 = long.Parse(param[0]); long f1 = long.Parse(param[1]); long n = long.Parse(param[2]); long result = 0; switch (n % 3) { case 0: result = f0; break; case 1: result = f1; break; case 2: result = f1 ^ f0; break; } Console.WriteLine(result); } } }