#include #include #include using namespace std; int main() { long long int x, y, n; long long int ans[3]; cin >> x >> y >> n; ans[0] = x; ans[1] = y; ans[2] = x ^ y; cout << ans[n%3] << endl; return 0; }