def solve(N): if N > 100: return N + 5.0/3.0 ps = [0] * (N + 6) hs = [0] * (N + 6) ps[0] = 1.0 hs[0] = 0 for i in range(N): difp = ps[i] / 6.0 difh = (hs[i] + ps[i]) / 6.0 for j in range(1, 7): ps[i + j] += difp hs[i + j] += difh fN = hs[N] / ps[N] gN = sum(hs[N + 1:])/sum(ps[N + 1:]) return fN + gN * (1 - ps[N])/ps[N] T = int(input()) for t in range(T): print(solve(int(input())))