#include #include int main(void) { long a, b, c, d; scanf("%ld %ld %ld", &a, &b, &c); switch (c % 3){ case 0: d = a; break; case 1: d = b; break; default: d = a ^b; break; } printf("%ld\n", d); return EXIT_SUCCESS; }