#include int main(){ long long int a,b,c,n; scanf("%lld%lld%lld",&a,&b,&n); for(n--;n;n--){ c = a^b; a=b; b=c; } printf("%lld\n",c); return 0; }