#include using namespace std; typedef long long LL; #ifdef BTK #define DEBUG if(1) #else #define CIN_ONLY if(1) struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}} }star; #define DEBUG if(0) #endif #define ALL(v) (v).begin(),(v).end() #define REC(ret, ...) std::function template inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;} template inline bool chmax(T &l, T r){bool a = listream& operator>>(istream &is, vector &v){for (auto &it : v)is >> it;return is;} class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x> 16; } }; struct high{ static inline int fix(const int a) { return q[a] >> 16; } }; template void sortHalf(const ITR bg, const ITR ed) { const int n = distance(bg, ed); PoolManeger maneger; node* const t = maneger.data; link base = maneger.getRange(RT); for (int i = 0; i < RT; i++) { t[base + i].next = END; } for (auto it = bg; it != ed; ++it) { int fixed = FIX::fix(*it); const link id = maneger.get(); t[id].next = t[fixed].next; t[fixed].next = id; t[id].val = *it; } auto ptr = bg; for (int i = 0; i < RT; i++) { for (link p = t[base + i].next; p != END; p = t[p].next) { (*ptr) = t[p].val; ++ptr; } } } template void sort(const ITR bg,const ITR ed) { sortHalf(bg, ed); reverse(bg, ed); sortHalf(bg, ed); } } using ull = unsigned long long; ull seed; inline int next() { seed = seed ^ (seed << 13); seed = seed ^ (seed >> 7); seed = seed ^ (seed << 17); return (seed >> 33); } int main() { int N, Q; cin >> N >> Q >> seed; for (int i = 0; i < 10000; i++) next(); for (int i = 0; i < N; i++) a[i] = next(); for (int i = 0; i < Q; i++) q[i] = next(); LL ret = 0; sort(a,a+N); iota(id, id + Q, 0); Radix::sort(id, id + Q); LL j = 0; for (int i : range(Q)) { while (j < N&&a[j] < q[id[i]])j++; ret ^= j * id[i]; } cout << ret << endl; return 0; }