#include using namespace std; using ll = long long; 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; } int main(void) { ll seed; cin >> seed; x = seed; int n = 10000001; uint32_t L = 2140000000, R = 2151000000; ll cntL = 0; vector v; for (int i = 0; i < n; i++) { uint32_t x = generate(); if (x >= L && x <= R) { v.push_back(x); } else if (x < L) { cntL++; } } sort(v.begin(), v.end()); assert(cntL <= n / 2 && cntL + (ll)v.size() > n / 2); cout << v[n / 2 - cntL] << endl; return 0; }