#define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define MT make_tuple #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< >(b,vector(c,d)) #define vvv(a,b,c,d,e) vector > >(b,vv(a,c,d,e)) using ll = long long; using pii = pair; using vi = vector; using vll = vector; // https://yukicoder.me/problems/no/702 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() { ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20); uint32_t seed; cin >> seed; ll ng = -1, ok = UINT32_MAX; while (ok - ng > 1) { x = seed, y = 1, z = 2, w = 3; ll val = (ok + ng) / 2; int cnt = 0; for (int i = 0; i < 10000001; i++) { ll a = generate(); if (a <= val)cnt++; } (cnt >= 5000001 ? ok : ng) = val; } cout << ok << endl; }