object Main extends App{ val s = readLine.split(" ").map(_.toLong) val n = s(2) % 3 val a = if(n == 2) s(0) ^ s(1) else s(n.toInt) println(a) }