#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; int main() { int T; cin >> T; vector N(T); for (int i = 0; i < T; ++i) { cin >> N[i]; } vector P(7, 0.0); vector dp(1000010, 0.0); dp[1] = 1.0; dp[2] = 1.0833333333333333; dp[3] = 1.2569444444444444; dp[4] = 1.5353009259259260; dp[5] = 1.6915991512345676; dp[6] = 2.0513639724794235; for (int n = 1; n <= 5; ++n) { double p = dp[n + 1] - 1; for (int i = 1; i <= n - 1; ++i) { p -= dp[n - i + 1] * P[i]; } P[n] = p; } P[6] = 1.0 - (P[1] + P[2] + P[3] + P[4] + P[5]); for (int i = 1; i <= 6; ++i) { cout << P[i] << endl; } for (int n = 7; n <= 1000000; ++n) { dp[n] = 1.0; for (int i = 1; i <= 6; ++i) { dp[n] += P[i] * dp[n - i]; } } for (int n : N) { cout << fixed << setprecision(10) << dp[n] << endl; } return 0; }