#include #include #define repeat(i,n) for (int i = 0; (i) < (n); ++(i)) #define repeat_reverse(i,n) for (int i = (n)-1; (i) >= 0; --(i)) typedef long long ll; using namespace std; template using matrix = array,H>; template matrix operator * (matrix const & p, matrix const & q) { matrix r = {}; repeat (y,A) { repeat (z,B) { repeat (x,C) { r[y][x] += p[y][z] * q[z][x]; } } } return r; } template array operator * (matrix const & p, array const & q) { array r = {}; repeat (y,A) { repeat (z,B) { r[y] += p[y][z] * q[z]; } } return r; } template matrix matrix_zero() { return {}; } template matrix matrix_unit() { matrix a = {}; repeat (i,N) a[i][i] = 1; return a; } int main() { int t; scanf("%d", &t); while (t --) { ll n; scanf("%lld", &n); array,7> af = matrix_unit(); array,7> ae { 1./6, 1./6, 1./6, 1./6, 1./6, 1./6, 1 , 1, 0, 0, 0, 0, 0, 0 , 0, 1, 0, 0, 0, 0, 0 , 0, 0, 1, 0, 0, 0, 0 , 0, 0, 0, 1, 0, 0, 0 , 0, 0, 0, 0, 1, 0, 0 , 0, 0, 0, 0, 0, 0, 1 }; array ax = { 0, 0, 0, 0, 0, 0, 1 }; array,6> bf = matrix_unit(); array,6> be { 1./6, 1./6, 1./6, 1./6, 1./6, 1./6 , 1, 0, 0, 0, 0, 0 , 0, 1, 0, 0, 0, 0 , 0, 0, 1, 0, 0, 0 , 0, 0, 0, 1, 0, 0 , 0, 0, 0, 0, 1, 0 }; array bx = { 1, 0, 0, 0, 0, 0 }; for (ll i = 1; i <= n; i <<= 1) { if (n & i) { af = af * ae; bf = bf * be; } ae = ae * ae; be = be * be; } long double a = (af * ax)[0]; long double b = (bf * bx)[0]; long double ans = a / b; printf("%.18llf\n", ans); } return 0; }