#include int main(void){ long long int f0,f1,n; scanf("%lld %lld %lld",&f0,&f1,&n); switch(n%3){ case 0: printf("%lld\n",f0); break; case 1: printf("%lld\n",f1); break; case 2: printf("%lld\n",f0^f1); break; } return 0; }