#include #include #include using namespace std; uint32_t x = 0, y = 1, z = 2, w = 3; uint32_t generate() { uint32_t t = (x^(x<<11)); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); return w; } uint32_t median = 2'147'483'648; uint32_t width = 5'000'000; uint32_t lower_limit = median - width; uint32_t upper_limit = median + width; int main(void) { int64_t seed; cin >> seed; x = seed; vector pool; int count_small = 0; uint32_t a; for (int i = 0; i < 10000001; i++) { a = generate(); if (a < lower_limit){ ++count_small; }else if (a <= upper_limit){ pool.push_back(a); } } sort(pool.begin(), pool.end()); int n = 5'000'000 - count_small; cout << pool[n] << endl; return 0; }