long long a,b,c;main(){scanf("%lld%lld%lld",&a,&b,&c);c=!printf("%lld",c%3?c%3-1?a^b:b:a);}