#include #include #include #include #include #include #include using namespace std; typedef long long LL; int main(){ LL f0, f1, N; cin >> f0 >> f1 >> N; if(N % 3 == 0){ cout << f0 << endl; }else if(N % 3 == 1){ cout << f1 << endl; }else{ cout << (f0^f1) << endl; } return 0; }