#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; int fn; if(N % 3 == 0) { fn = f0; } if(N % 3 == 1) { fn = f1; } if(N % 3 == 2) { fn = f2; } cout << fn << endl; return 0; }