let inpt = readLine()!.split(separator: " ").map({Int($0)!}) let num = inpt[0] ^ inpt[1] let arr = [inpt[0], inpt[1], num] let ans = arr[inpt[2]%3] print(ans)