#include #define rep(i, ss, ee) for (int i = ss; i < ee; ++i) using namespace std; void solve() { int N; vector v(3); rep(i, 0, 2) { cin >> v[i]; }; v[2] = v[0] ^ v[1]; cin >> N; cout << v[N % 3] << endl; } int main() { ios::sync_with_stdio(false); cin.tie(0); solve(); getchar(); }