#include #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() { array<__float128,7> ax = { 0, 0, 0, 0, 0, 0, 1 }; array<__float128,6> bx = { 1, 0, 0, 0, 0, 0 }; vector,7> > aes; vector,6> > bes; { 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,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 }; repeat (i,64) { aes.push_back(ae); bes.push_back(be); ae = ae * ae; be = be * be; } } int t; scanf("%d", &t); while (t --) { ll n; scanf("%lld", &n); array,7> af = matrix_unit<__float128,7>(); array,6> bf = matrix_unit<__float128,6>(); repeat (i,64) if (n & (1ll << i)) { af = af * aes[i]; bf = bf * bes[i]; } __float128 a = (af * ax)[0]; __float128 b = (bf * bx)[0]; long double ans = a / b; printf("%.18llf\n", ans); } return 0; }