#include #include #include using namespace std; typedef long long lint; typedef vectorvi; typedef pairpii; #define rep(i,n)for(int i=0;i<(int)(n);++i) using ll = long long; using ull = unsigned long long; ull seed; 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(); vector a(n); for (int i = 0; i < n; i++) a[i] = next(); sort(a.begin(), a.end()); ll sm = 0; for (int i = 0; i < q; i++) { int x = next(); int cnt = lower_bound(a.begin(),a.end(),x)-a.begin(); sm ^= ll(cnt) * i; } cout << sm << endl; return 0; }