/** * author: ekusiadadus * created: 24.02.2022 01:49:18 **/ #include using namespace std; using i64 = long long; i64 seed; uint32_t x = 0, y = 1, z = 2, w = 3; i64 generate() { uint32_t t = (x ^ (x << 11)); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); return (i64)w; } int count(i64 c) { x = seed, y = 1, z = 2, w = 3; int res = 0; for(int i = 0; i < 10000001; ++i) if(generate() <= c) res++; return res; } int main() { cin >> seed; i64 ng = 0, ok = 1e18; while (ng + 1 != ok) { i64 md = (ng + ok) / 2; if (5000001 <= count(md)) ok = md; else ng = md; } cout << ok << endl; return 0; }