#include #include #include using lli = long long int; using ull = unsigned long long int; #define REP(i, n) for(int (i) = 0; (i) < (n); (i)++) ull seed; int next(){ seed ^= (seed << 13); seed ^= (seed >> 7); seed ^= (seed << 17); return seed >> 33; } constexpr int SEED_TIME = 10000; constexpr int RANGE = 1 << 14; constexpr int NUMBER = (__INT_MAX__ / RANGE); std::vector A[NUMBER + 2]; int S[NUMBER + 3]; int x, y, a, b, t; int main(void){ int n, q; scanf("%d%d%llu", &n, &q, &seed); REP(_, SEED_TIME) next(); REP(i, n){ x = next(); a = x / RANGE; A[a].push_back(x); } S[0] = 0; REP(i, NUMBER + 1) S[i+1] = S[i] + A[i].size(); lli res = 0; REP(i, q){ x = next(); y = x / RANGE; lli cnt = S[y]; for(int aa : A[y]) if(aa < x) cnt++; res ^= cnt * i; } printf("%lld\n", res); return 0; }