#include #include typedef int64_t i64; typedef uint64_t u64; int main() { u64 f0, f1, n; scanf("%lu %lu %lu", &f0, &f1, &n); u64 a[3] = {f0, f1, f0 ^ f1}; printf("%lu\n", a[n%3]); return 0; }