#include using namespace std; int main(){ long long F0, F1, N; cin >> F0 >> F1 >> N; if (N % 3 == 0){ cout << F0 << endl; } if (N % 3 == 1){ cout << F1 << endl; } if (N % 3 == 2){ cout << (F0 ^ F1) << endl; } }