using System; using System.Linq; class Program { static void Main() { long[] l = Console.ReadLine().Split().Select(long.Parse).ToArray(); long n = l[2]; long[] f = new long[3]; f[0] = l[0]; f[1] = l[1]; f[2] = f[0] ^ f[1]; Console.WriteLine(f[n % 3]); } }