#include using namespace std; int main() { long long int N, F0, F1; cin >> F0 >> F1 >> N; if( N == 0 ) { cout << F0 << endl; return 0; } if( N == 1 ) { cout << F1 << endl; return 0; } long long int tmp; tmp = F0; for( long long int i = 0; i < N ; i++ ) { tmp = F0; F0 = F1; F1 = F1 ^ tmp; } cout << F0 << endl; return 0; }