#include "bits/stdc++.h" #include #include #include using namespace __gnu_pbds; using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; #define rep(i, m, n) for (ll i = (ll)m; i < (ll)n; i++) #define drep(i, m, n) for (ll i = m - 1; i >= n; i--) #define Endl endl #define all(a) a.begin(), a.end() #define pr(i, j) make_pair(i, j) #define isin(x, l, r) (l <= x && x < r) #define chmin(a, b) a = min(a, b) #define chmax(a, b) a = max(a, b) #define srt(ar) sort(ar.begin(), ar.end()) #define rev(ar) reverse(ar.begin(), ar.end()) #define jge(f, s, t) cout << (f ? s : t) << endl template using ordered_set = tree, rb_tree_tag, tree_order_statistics_node_update>; #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define printar(ar) \ do \ { \ for (auto dbg : ar) \ { \ cout << dbg << " "; \ } \ cout << endl; \ } while (0) const ll inf = 1e18; const ld pi = 3.14159265358979; const ld eps = 1e-9; template auto make_vec(const ll (&d)[n], const T &init) noexcept { if constexpr (idx < n) return std::vector(d[idx], make_vec(d, init)); else return init; } template auto make_vec(const ll (&d)[n]) noexcept { return make_vec(d, T{}); } //////////////// 以下を貼る //////////////// template size_t HashCombine(const size_t seed, const T &v) { return seed ^ (std::hash()(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2)); } /* pair用 */ template struct std::hash> { size_t operator()(const std::pair &keyval) const noexcept { return HashCombine(std::hash()(keyval.first), keyval.second); } }; /* vector用 */ template struct std::hash> { size_t operator()(const std::vector &keyval) const noexcept { size_t s = 0; for (auto &&v : keyval) s = HashCombine(s, v); return s; } }; /* tuple用 */ template struct HashTupleCore { template size_t operator()(const Tuple &keyval) const noexcept { size_t s = HashTupleCore()(keyval); return HashCombine(s, std::get(keyval)); } }; template <> struct HashTupleCore<0> { template size_t operator()(const Tuple &keyval) const noexcept { return 0; } }; template struct std::hash> { size_t operator()(const tuple &keyval) const noexcept { return HashTupleCore>::value>()(keyval); } }; //////////////////////////////////////////// int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll a, b, n; cin >> a >> b >> n; ll x = a ^ b; vector ar = {a, b, x}; cout << ar[n % 3] << Endl; }