t=int(input()) from copy import deepcopy a=[[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]] b=[[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]] def mat(x,y): n=len(x) new=[[0]*n for i in range(n)] for i in range(n): for j in range(n): for k in range(n): new[i][j]+=x[i][k]*y[k][j] return new def mul (x,n): if n==1:return x res=deepcopy(mul(x,n//2)) res=deepcopy(mat(res,res)) if n%2==0: return res return mat(res,x) for _ in range(t): n=int(input()) an=mul(a,n) A=an[0][5]+an[0][1]+an[0][2]+an[0][3]+an[0][4] bn=mul(b,n) B=bn[0][6] print(B/(1-A))