#include using namespace std; typedef long long signed int LL; typedef long long unsigned int LU; #define incID(i, l, r) for(int i = (l) ; i < (r); i++) #define incII(i, l, r) for(int i = (l) ; i <= (r); i++) #define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--) #define decII(i, l, r) for(int i = (r) ; i >= (l); i--) #define inc(i, n) incID(i, 0, n) #define inc1(i, n) incII(i, 1, n) #define dec(i, n) decID(i, 0, n) #define dec1(i, n) decII(i, 1, n) #define inII(v, l, r) ((l) <= (v) && (v) <= (r)) #define inID(v, l, r) ((l) <= (v) && (v) < (r)) #define PB push_back #define EB emplace_back #define MP make_pair #define FI first #define SE second #define PQ priority_queue #define ALL(v) v.begin(), v.end() #define RALL(v) v.rbegin(), v.rend() #define FOR(it, v) for(auto it = v.begin(); it != v.end(); ++it) #define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it) template bool setmin(T & a, T b) { if(b < a) { a = b; return true; } else { return false; } } template bool setmax(T & a, T b) { if(b > a) { a = b; return true; } else { return false; } } template bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } } template bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } } template T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); } template T lcm(T a, T b) { return a / gcd(a, b) * b; } // ---- ---- int t, n[50]; double p[7], r[6], a[7] = { 0.0000000000000000, 1.0000000000000000, 1.0833333333333333, 1.2569444444444444, 1.5353009259259260, 1.6915991512345676, 2.0513639724794235 }; double P[1000000][7]; double E[1000000][7]; double ans(int v) { double s = 0; inc1(i, 6) { inc1(j, 6) { if(v - i >= 0 && v - i + j >= v) { s += E[v - i][j]; } } } return s; } int main() { cin >> t; inc(i, t) { cin >> n[i]; } inc(i, 6) { r[i] = a[i + 1] - a[i]; } inc1(i, 6) { if(i < 6) { p[i] = r[i]; inc1(j, i - 1) { p[i] -= p[j] * r[i - j]; } } else { p[i] = 1; inc1(j, i - 1) { p[i] -= p[j]; } } } P[0][0] = 1; E[0][0] = 0; inc(i, 1000000) { inc1(j, 6) { P[i][0] += (i - j >= 0 ? P[i - j][j] : 0); E[i][0] += (i - j >= 0 ? E[i - j][j] : 0); } inc1(j, 6) { P[i][j] = P[i][0] * p[j]; E[i][j] = (E[i][0] + P[i][0]) * p[j]; } } inc(i, t) { printf("%.12f\n", ans(n[i])); } return 0; }