#include using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(false); vector f(2); long long int n; for(auto &a:f) cin >> a; cin >> n; long long int tmp; tmp = f[0] ^ f[1]; f.push_back(tmp); // for(auto a:f) cout << a << endl; cout << f[n%3] << endl; return 0; }