#include #include #define FORR(i,b,e) for(int i=(b);i<(int)(e);++i) #define FOR(i,e) FORR(i,0,e) #define dump(var) cerr << #var ": " << var << "\n" #define dumpc(con) for(auto& e: con) cerr << e << " "; cerr<<"\n" typedef long long ll; typedef unsigned long long ull; using namespace std; double p[6]; // = {1/12, 2/12, 3/12, 1/12, 3/12, 2/12}; double exref[] = { 0, 1.0000000000000000, 1.0833333333333333, 1.2569444444444444, 1.5353009259259260, 1.6915991512345676, 2.0513639724794235, }; double dp[1000100]; void bottomup(int e) { dp[0] = 0; FORR(i, 1, e+1) { dp[i] = 1; FOR(j, 6) if (i-j-1 >= 0) dp[i] += dp[i-j-1] * p[j]; } } int main() { cin.tie(0); ios::sync_with_stdio(false); fill(p, p+6, 0); FOR(k, 5) { double a = 0, b = 1, c; FOR(i, k) b -= p[i]; FOR(m, 40) { // bisection method c = (a+b) / 2; p[k] = c; p[5] = 1; FOR(i, 5) p[5] -= p[i]; bottomup(k+2); if (dp[k+2] > exref[k+2]) b = c; else a = c; } p[k] = c; p[5] = 1; FOR(i, 5) p[5] -= p[i]; } bottomup(1000000); int T, N; cin >> T; while (T--) { cin >> N; cout << fixed << setprecision(6) << dp[N] << "\n"; } return 0; }