#include int main() { unsigned long f0, f1, n; std::cin >> f0 >> f1 >> n; if (n == 0) { std::cout << f0 << std::endl; } else if (n == 1) { std::cout << f1 << std::endl; } else { unsigned long fi, fi_1, fi_2; fi_1 = f1; fi_2 = f0; for (unsigned long i = 2; i <= n; i++) { fi = fi_1 ^ fi_2; fi_2 = fi_1; fi_1 = fi; } std::cout << fi << std::endl; } return 0; }