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 double DP_calc(final int K){ final int size = 6 * K; double[][] ok = new double[K + 1][size + 1]; double[] over = new double[K + 1]; ok[0][0] = 1; for(int i = 1; i <= 6; i++){ ok[1][i] = 1.0 / 6; } for(int i = 2; i <= K; i++){ for(int j = 0; j <= size; j++){ for(int k = 1; k <= 6; k++){ final int index = j - k; if(index < 0){ continue; } if(index >= K){ continue; } ok[i][j] += ok[i - 1][index] / 6; } } } for(int i = 1; i <= K; i++){ for(int j = 1; j <= 5; j++){ final int index = K - j; if(index < 0){ continue; } if(index >= K){ continue; } //System.out.println(i + " " + j + " " + index); over[i] += ok[i - 1][K - j] * (1.0 - j / 6.0); } } double upper_sum = 0; for(int i = 1; i <= K; i++){ upper_sum += (ok[i][K] + over[i]) * i; } final double over_sum = Arrays.stream(over).sum(); return (upper_sum) / (1 - over_sum); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int T = sc.nextInt(); for(int tt = 0; tt < T; tt++){ final long N = sc.nextLong(); if(N <= 100){ System.out.printf("%.15f\n", DP_calc((int)N)); }else{ System.out.println((N + 1) + ".666666666666666"); } } } }