#include #include #include #include #include #include #include #include #include #include const int mod = 1e9 + 7; const long long INF = 1LL << 60; using namespace std; typedef long long ll; int main() { ll a,b,n; cin >> a >> b >> n; if(n == 0) cout << a << endl; if(n == 1) cout << b << endl; else{ for(int i = 0; i < n-1; i++){ ll tmp = a ^ b; a = b; b = tmp; } cout << b << endl; } }