using System; using System.Collections.Generic; using System.Linq; namespace yukicode { public class Program { static UInt64 F0, F1, N; public static UInt64 FNumber(UInt64 n) { return n >= 2 ? (FNumber( n - 1 ) ^ FNumber( n - 2 )) : ( n == 1 ? F1 : F0 ); } public static UInt64 Solver(System.IO.TextReader reader) { var buf = reader.ReadLine().Split(); F0 = UInt64.Parse( buf[ 0 ] ); F1 = UInt64.Parse( buf[ 1 ] ); N = UInt64.Parse( buf[ 2 ] ); return FNumber( N ); } private static void Main() { Console.WriteLine( Solver( Console.In ) ); } } }