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