#include #include #include #include using namespace std; const int MAX_N = 1000010; double value[MAX_N]; map prob = { {1, 1.0/12.0}, {2, 1.0/6.0}, {3, 1.0/4.0}, {4, 1.0/12.0}, {5, 1.0/4.0}, {6, 1.0/6.0} }; int main() { int t; cin >> t; memset(value, 0.0, sizeof(value)); for (int sum = 1; sum <= MAX_N; sum++) { value[sum] = 1.0; for (int d = 1; d <= 6; d++) { int prev = max(0, sum - d); value[sum] += value[prev] * prob[d]; } } while (t--) { int n; cin >> n; cout << fixed << setprecision(10) << value[n] << endl; } return 0; }