import sys input = sys.stdin.readline def solve(x): OK=0 NG=1<<60 while NG>OK+10**(-6): mid=(OK+NG)/2 DP=[0]*x for i in range(x-1,-1,-1): score=6 for j in range(1,7): if i+j==x: score+=0 elif i+j>x: score+=mid else: score+=DP[i+j] if i!=0: DP[i]=score/6 else: if score/6>mid: OK=mid else: NG=mid return OK t=int(input()) for tests in range(t): N=int(input()) if N<=150: print(solve(N)) else: print(N+5/3)