t = int(input()) M = 10**6 dp = [0.0]*(M+1) p = [0,1/12,1/6,1/4,1/12,1/4,1/6] #試行錯誤で見つけた for i in range(1,M+1): r = 0.0 for j in range(1,7): r += dp[i-j]*p[j] if i-j > 0 else 0 dp[i] = 1.0 + r for _ in range(t): print(dp[int(input())])