print((function (f, g) local a,b,m = g() return tostring(m==0 and a or m==1 and b or f(a,b)):sub(1,-3) end)((function (ffi) ffi.cdef 'int scanf(const char *, ...);' local C,typeof,bxor = ffi.C,ffi.typeof,bit.bxor local p,u = typeof("int64_t[1]"),typeof("union { int64_t n64; int32_t n32[2]; }") local a,b,c = p(),p(),p() function bxor64(_a, _b, ...) -- https://github.com/justincormack/ljsyscall/blob/master/syscall/bit.lua local a,b,r = u(_a),u(_b),u() r.n32[0],r.n32[1] = bxor(a.n32[0],b.n32[0]),bxor(a.n32[1],b.n32[1]) if select("#",...)>0 then return bxor64(r.n64, ...) end return r.n64 end return bxor64, function () C.scanf("%ld%ld%ld",a,b,c) return a[0],b[0],c[0]%3 end end)(require'ffi')))