#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; double TIME_LIMIT = 4.5; ll startCycle; const ll CYCLE_PER_SEC = 2700000000; unsigned long long int getCycle() { unsigned int low, high; __asm__ volatile ("rdtsc" : "=a" (low), "=d" (high)); return ((unsigned long long int) low) | ((unsigned long long int) high << 32); } double getTime(unsigned long long int begin_cycle) { return (double) (getCycle() - begin_cycle) / CYCLE_PER_SEC; } unsigned long long xor128() { static unsigned long long rx = 123456789, ry = 362436069, rz = 521288629, rw = 88675123; unsigned long long rt = (rx ^ (rx << 11)); rx = ry; ry = rz; rz = rw; return (rw = (rw ^ (rw >> 19)) ^ (rt ^ (rt >> 8))); } int main() { int K; cin >> K; startCycle = getCycle(); ll loop_cnt = 0; ll sum = 0; double currentTime = getTime(startCycle); while (currentTime < TIME_LIMIT) { int n = 0; int cnt = 0; while (n < K) { n += (xor128() % 6) + 1; if (n > K) n = 0; ++cnt; } ++loop_cnt; sum += cnt; currentTime = getTime(startCycle); } cout << fixed << setprecision(10) << sum / (double) loop_cnt << endl; return 0; }