#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define INF 1000000000 #define EPS 1e-9 #define PI acos(-1) typedef long long ll; typedef pair P; ll F[3], N; int main(){ cin >> F[0] >> F[1] >> N; for(int i = 2; i <= N; i++){ F[i%3] = F[(i-1)%3]^F[(i-2)%3]; } cout << F[N%3] << endl; return 0; }