#include using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) void bit_print(int x) { vector b; while(x > 0) { b.push_back(x & 1); x >>= 1; } reverse(b.begin(), b.end()); rep(i, b.size()) { cout << b[i]; }cout << endl; } int main() { int f0, f1, f2, N; cin >> f0 >> f1 >> N; f2 = f0 ^ f1; f0 = f1, f1 = f2; int fn; if(N % 3 == 0) { fn = f2; } if(N % 3 == 1) { fn = f0; } if(N % 3 == 2) { fn = f1; } cout << fn << endl; return 0; }