def exp(N): A = [0] * (N + 1) B = [0] * (N + 1) inv = 1.0 / 6 for i in range(N - 1, -1, -1): for j in range(1, 7): if i + j > N: A[i] += inv B[i] += inv else: A[i] += (A[i + j] + 1) * inv B[i] += B[i + j] * inv return A[0] / (1 - B[0]) T = int(raw_input()) for _ in range(T): N = int(raw_input()) if N < 84: print exp(N) else: print (N + 5) / 3.0