#include using namespace std; int main() { int n, q; uint64_t seed; auto next = [&]{ seed ^= seed << 13; seed ^= seed >> 7; seed ^= seed << 17; return seed >> 33; }; cin >> n >> q >> seed; for (int i = 0; i < 10000; i++) { next(); } vector a(n); for (auto &i : a) { i = next(); } sort(a.begin(), a.end()); int64_t ans = 0; for (int64_t i = 0; i < q; i++) { int x = next(); int64_t count = distance(a.begin(), lower_bound(a.begin(), a.end(), x)); ans ^= count * i; } cout << ans << endl; return 0; }