import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.Scanner; import java.util.Set; public class Main { public static final int MAX = 1000000; public static void main(String[] args){ Scanner sc = new Scanner(System.in); final int T = sc.nextInt(); // sum(w[1 .. 6]) = 1 // N = 1 -> 1.0 (定義より, w[1] + ... + w[6] = 1) /* N = 2 -> (1 - w[1]) * 1 + w[1] * (DP[1] + 1) = DP[2] * ->> w[1] * DP[1] + 1 = DP[2] * * N = 3 -> (1 - w[1] - w[2]) * 1 + w[2] * (DP[1] + 1) + w[1] * (DP[2] + 1) = DP[3] = ... * -> 1 - w[1] - w[2] + w[2] * (DP[1] + 1) + w[1] * (DP[2] + 1) = DP[3] * -> w[2] * DP[1] + w[1] * DP[2] + 1 = DP[3] * * N = 4 -> (1 - w[1] - w[2] - w[3]) * 1 + w[3] * (DP[1] + 1) + w[2] * (DP[2] + 1) + w[1] * (DP[3] + 1) * -> w[3] * DP[1] + w[2] * DP[2] + w[1] * DP[3] + 1 = DP[4] */ double[] pre_DP = new double[6 + 1]; pre_DP[1] = 1.0000000000000000; pre_DP[2] = 1.0833333333333333; pre_DP[3] = 1.2569444444444444; pre_DP[4] = 1.5353009259259260; pre_DP[5] = 1.6915991512345676; pre_DP[6] = 2.0513639724794235; double[] weights = new double[7]; double sum = 0; for(int i = 1; i <= 5; i++){ double w = pre_DP[i + 1] - 1; for(int j = 1; j < i; j++){ w -= weights[j] * pre_DP[i - j + 1]; } weights[i] = w; sum += w; } weights[6] = 1 - sum; for(int tt = 0; tt < T; tt++){ final int N = sc.nextInt(); double[] DP = new double[N + 6]; for(int cur = N - 1; cur >= 0; cur--){ DP[cur] = 1; for(int i = 1; i <= 6; i++){ DP[cur] += DP[cur + i] * weights[i]; } } System.out.printf("%.8f\n", DP[0]); } } }