using System; using System.Collections.Generic; using System.Linq; class Program76 { private static double calculate(double[] expectations, double[] percentange, int lowerValue) { double sum = 1; int first = Math.Max(lowerValue - 6, 0); for (int sourceIndex = first; sourceIndex <= lowerValue - 1; sourceIndex++) { for (int p = 1; p <= 6; p++) { if (sourceIndex + p == lowerValue) { sum += percentange[p] * expectations[sourceIndex]; } } } return sum; } public static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); List values = new List(); for (int i = 0; i < n; i++) { values.Add(int.Parse(Console.ReadLine())); } double[] expected = new double[1010000]; expected[1] = 1; expected[2] = 1.0833333333333333; expected[3] = 1.2569444444444444; expected[4] = 1.5353009259259260; expected[5] = 1.6915991512345676; expected[6] = 2.0513639724794235; double[] dicePercentage = new double[7]; expected[1] = 1; for (int j = 1; j <= 5; j++) { double lower = 0; double upper = 1; for (int i = 0; i < 70; i++) { double mid = lower + upper; mid /= 2d; dicePercentage[j] = mid; int lowerValue = j + 1; var result = calculate(expected, dicePercentage, lowerValue); if (result < expected[j + 1]) { lower = mid; } else { upper = mid; } } } dicePercentage[6] = 1 - dicePercentage.Sum(); for (int i = 7; i <= 100001; i++) { expected[i] = calculate(expected, dicePercentage, i); } foreach (var element in values) { Console.WriteLine(expected[element]); } } }