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