#include using namespace std; #define int long long signed main(){ int a,b,c;cin>>a>>b>>c; if(c%3==2)cout<<(a^b)<