using System; using System.Collections.Generic; using System.Linq; namespace yukicodeX { public class ProgramX { public static UInt64 Solver(System.IO.TextReader reader) { var buf = reader.ReadLine().Split(); UInt64[] f=new UInt64[3]; f[0] = UInt64.Parse(buf[0]); f[1] = UInt64.Parse(buf[1]); f[2] = f[0] ^ f[1]; var n = UInt64.Parse(buf[2]); return f[n%3]; } private static void Main() { Console.WriteLine( Solver( Console.In ) ); } } }