#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(){ int64_t seed; int64_t ok = -1, ng = 1ll << 40 , mid, N = 10000001; cin >> seed; while(ok + 1 < ng){ mid = (ok + ng) / 2; x = seed, y = 1, z = 2, w = 3; uint32_t cnt = 0; for(uint32_t i = 0; i < N; i++){ cnt += (mid >= generate()); } if(cnt < (N + 1) / 2)ok = mid; else ng = mid; } cout << ok + 1 << endl; }