import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class No64 { public static void main(String[] args) throws IOException{ //XORフィボナッチ数列 String[] text = readStr()[0].split(" "); Long F = Long.parseLong(text[0]) , FF = Long.parseLong(text[1]) , N = Long.parseLong(text[2]); switch(Math.floorMod(N, 3)) { case 1 : F = FF; break; case 2 : F = F ^ FF; } System.out.println(F); } public static String[] readStr() throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList list = new ArrayList<>(); do { list.add(br.readLine()); }while(br.ready()); br.close(); String[] text = new String[list.size()]; list.toArray(text); return text; } }