#include using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; typedef vector vll; typedef vector vi; typedef vector> vvi; typedef vector> vvll; const ll inf = 1e16; const ll md = 1000000007; int main() { int f0,f1,n; cin>>f0>>f1>>n; int ans; if(n%3==0) ans=f0; if(n%3==1) ans=f1; if(n%3==2) ans=f0^f1; cout<