#include #define ll long long using namespace std; int main() { ll n; vector f(n+1,0); cin >> f[0] >> f[1] >> n; for(ll i = 2; i <= n; i++) f[i] = f[i-1] ^ f[i-2]; cout << f[n] << endl; return 0; }