#include #include #include #include #include #include using namespace std; const int MAX_ROLL = 1e8; int main() { int k; cin >> k; int seed = 0; mt19937 mt(seed); uniform_int_distribution<> dice(1, 6); int sum = 0; int start = 0; long long success = 0; for (int i = 0; i < MAX_ROLL; i++) { sum += dice(mt); if (sum == k) { success++; sum = 0; } else if (sum > k) { sum = 0; } } double ans = success != 0 ? 1.0 * MAX_ROLL / success : MAX_ROLL; printf("%.6f\n", ans); return 0; }