import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // dp[i]は和がi以上となるまでに振る回数の期待値 double[] dp = new double[1000001]; for(int i = 1; i < 1000001; i++) { double s = 0; for(int j = 1; j <= 6; j++) { if(i - j >= 0) s += (dp[i - j] + 1); } dp[i] = s / (double)6; } int T = sc.nextInt(); for(int i = 0; i < T; i++) { System.out.println(dp[sc.nextInt()]); } } }