#include #include #include #include #include #include using namespace std; int main(){ long long int f[2],ans; int n; cin >> f[0] >> f[1] >> n; if(!n)n=3; if(n%3!=2)ans = f[n%3]; else ans = (f[0]^f[1]); cout << ans <