#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair Pr; ll F0, F1, N; int main() { cin >> F0 >> F1 >> N; ll Fn = F0^F1; if (N == 2) printf("%lld\n",F0^F1); else if (N == 1) cout << F1 << endl; else if (N == 0) cout << F0 << endl; else if (N % 2 == 0)cout << F1 << endl; else cout << Fn << endl; return 0; }