#include int main() { long long f0, f1, n; scanf("%lld %lld %lld", &f0, &f1, &n); int rem=n%3; long long arr[3]={f0, f1, f0^f1}; printf("%lld\n", arr[rem]); return 0; }