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]) , count = 0l; while(count < N) { Long x = FF; FF = F ^ FF; F = x; count++; } 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; } }