import java.util.Scanner; public class Main_yukicoder76 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double[] e = {0.0, 1.0000000000000000, 1.0833333333333333, 1.2569444444444444, 1.5353009259259260, 1.6915991512345676, 2.0513639724794235}; double[] p = new double[6 + 1]; p[6] = 1.0; for (int i = 1; i <= 5; i++) { double tmp = 1; for (int j = 1; j < i; j++) { tmp += p[j] * e[i + 1 - j]; } p[i] = (e[i + 1] - tmp) / e[1]; p[6] -= p[i]; } e = new double[1000000 + 1]; for (int i = 1; i <= 1000000; i++) { double tmp = 1.0; for (int j = 1; j <= 6; j++) { if (i - j > 0) { tmp += e[i - j] * p[j]; } } e[i] = tmp; } int t = sc.nextInt(); for (int i = 0; i < t; i++) { System.out.printf("%.6f\n", e[sc.nextInt()]); } sc.close(); } }