#include #include using namespace std; //#define DISABLE_PRINT #if defined(ENABLE_PRINT) && !defined(DISABLE_PRINT) #define P(...) fprintf(stderr, __VA_ARGS__) #define LP fprintf(stderr, "L: %d\n", __LINE__) #else #define P(...) ((void)0) #define LP ((void)0) #endif #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define ALL(x) x.begin(), x.end() using ll = long long; using ull = unsigned long long; double p[6]; const double E[] = { 0, 1.0000000000000000, 1.0833333333333333, 1.2569444444444444, 1.5353009259259260, 1.6915991512345676, 2.0513639724794235, }; void setup() { p[0] = E[2] - 1; p[1] = E[3] - p[0] * E[2] - 1; p[2] = E[4] - p[0] * E[3] - p[1] * E[2] - 1; p[3] = E[5] - p[0] * E[4] - p[1] * E[3] - p[2] * E[2] - 1; p[4] = E[6] - p[0] * E[5] - p[1] * E[4] - p[2] * E[3] - p[3] * E[2] - 1; p[5] = 1 - (p[0] + p[1] + p[2] + p[3] + p[4]); } void solve() { int N; cin >> N; vector dp(N + 10); dp[N] = 0; rep(i, N) { auto ti = N - 1 - i; double u = 0; rep(j, 6) { u += dp[ti + j + 1] * p[j]; } u += 1; dp[ti] = u; } printf("%.15f\n", dp[0]); } int main() { setup(); int T; cin >> T; rep(i, T) solve(); return 0; }