#include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(i, a, n) for (int i = a; i < n; i++) #define REP(i, n) for(int i = 0; i < n; i++) struct omt{omt(){ios::sync_with_stdio(false);cin.tie(0);}}star; int main(){ vector v; REP(i, 2){ int tmp; cin >> tmp; v.push_back(tmp); } int n; cin >> n; FOR(i, 2, n + 1){ v.push_back(v[i - 2] ^ v[i - 1]); } cout << v[n] << endl; return 0; }