import java.util.Scanner; public class Main_yukicoder301 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); final double EPS = 1.e-13; int t = sc.nextInt(); for (int i = 0; i < t; i++) { long n = sc.nextLong(); double[] a = new double[6 + 1]; double[] b = new double[6 + 1]; long j; for (j = n - 1; j >= 0; j--) { b[(int)(j % 7)] = 1; a[(int)(j % 7)] = 0; for (int k = 1; k <= 6; k++) { if (j + k > n) { a[(int)(j % 7)] += (double)1 / 6; } else { a[(int)(j % 7)] += a[(int)((j + k) % 7)] / 6; b[(int)(j % 7)] += b[(int)((j + k) % 7)] / 6; } } if (b[(int)(j % 7)] / b[(int)((j + 1) % 7)] < EPS) { break; } } System.out.printf("%.13f\n", b[(int)((j + 1) % 7)] / (1 - a[(int)((j + 1) % 7)])); } sc.close(); } }