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