#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); } template using V = vector; template using VV = V>; ull seed; int next() { seed = seed ^ (seed << 13); seed = seed ^ (seed >> 7); seed = seed ^ (seed << 17); return (seed >> 33); } int main() { int n; uint q; cin >> n >> q >> seed; for (int i = 0; i < 10000; i++) next(); V a(n); for (int i = 0; i < n; i++) a[i] = next(); sort(begin(a), end(a)); ll sm = 0; for (uint i = 0; i < q/2; i++) { int x = next(); sm ^= (lower_bound(begin(a), end(a), x) - begin(a)) * i; } cout << sm << endl; return 0; }