# include # include #include # include #include #include #include # include # include # include # include # include # include # include # include # include # include # include # include # include # include # include # include # include # include # include # include # include # include using namespace std; using LL = long long; using ULL = unsigned long long; constexpr long long MOD = 1000000000 + 7; constexpr long long INF = std::numeric_limits::max(); const double PI = acos(-1); #define fir first #define sec second typedef pair Pll; typedef pair> Ppll; typedef pair>> Pbll; typedef pair>> Pvll; typedef pair Vec2; struct Tll { LL first, second, third; }; typedef pair Ptll; #define rep(i,rept) for(LL i=0;i=0;i--) LL h, w, n, m, k, s, t, q, ans, sum, last, cnt, a[10000000]; struct Edge { LL to, cost; }; string str; char c[1000][1000]; bool f = 0; void YN(bool f) { if (f) cout << "YES" << endl; else cout << "NO" << endl; } void yn(bool f) { if (f) cout << "Yes" << endl; else cout << "No" << endl; } ULL seed; ULL next() { seed = seed ^ (seed << 13); seed = seed ^ (seed >> 7); seed = seed ^ (seed << 17); return (seed >> 33); } vectorvec[10000]; int main() { cin >> n >> q >> seed; for (int i = 0; i < 10000; i++) next(); for (int i = 0; i < n; i++) a[i] = next(); sort(a, a + n); rep(i, q) { LL x = next(); LL high = n, low = -1; while (high - low > 1) { LL midle = (high + low) / 2; if (a[midle] < x) low = midle; else high = midle; } s = i*(1+low); ans ^= s; } cout << ans << endl; return 0; }