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]); if(n == 0) { Console.WriteLine(f0); return; }else if(n == 1) { Console.WriteLine(f1); return; } long fk1 = f1; long fk2 = f0; for(long i = 2; i <= n; i++) { long fk = fk1 ^ fk2; fk2 = fk1; fk1 = fk; } Console.WriteLine(fk1); } } }