#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; double f(int K, double x) { vector dp(K + 1, 0.0); for (int i = 1; i <= K; ++i) { for (int j = 1; j <= 6; ++j) { if (j > i) { dp[i] += x; } else { dp[i] += dp[i - j]; } } dp[i] = dp[i] / 6.0 + 1; } return dp[K]; } double solver(int K) { double ok = INT_MAX; double ng = 0; for (int i = 0; i < 50; ++i) { double x = (ok + ng) / 2.0; if (f(K, x) <= x) { ok = x; } else { ng = x; } } return ok; } int main() { int T; cin >> T; for (int i = 0; i < T; ++i) { int N; cin >> N; if (N <= 200) { cout << fixed << setprecision(10) << solver(N) << endl; } else { cout << fixed << setprecision(10) << 5.0 / 3 + N << endl; } } return 0; }