#include #include #include #include #include #include #include #include #include #include #include #include #include #define FOR(i, a, b) for(int i=(a);i<=(b);i++) #define RFOR(i, a, b) for(int i=(a);i>=(b);i--) #define MOD 1000000007 #define INF 1000000000 #define PI 3.14159265358979 using namespace std; typedef pair P; int main(void) { long long int f0, f1, n; long long int tmp; cin >> f0 >> f1 >> n; FOR(i, 2, n) { tmp = f1; f1 = f1^f0; f0 = tmp; } if (n == 0) { cout << f0 << endl; } else { cout << f1 << endl; } return 0; }