#include using namespace std; namespace { typedef double real; typedef long long ll; template ostream& operator<<(ostream& os, const vector& vs) { if (vs.empty()) return os << "[]"; auto i = vs.begin(); os << "[" << *i; for (++i; i != vs.end(); ++i) os << " " << *i; return os << "]"; } template istream& operator>>(istream& is, vector& vs) { for (auto it = vs.begin(); it != vs.end(); it++) is >> *it; return is; } double dat[] = { 0, 1.0000000000000000, 1.0833333333333333, 1.2569444444444444, 1.5353009259259260, 1.6915991512345676, 2.0513639724794235 }; void input() { } void solve() { const int N = int(1e6 + 5); vector P(N, 0); vector PR(7, 0); for (int i = 0; i < 6; i++) P[i] = dat[i + 1] - dat[i]; for (int i = 1; i < 6; i++) { real r = P[i]; for (int j = 1; j <= i; j++) { r -= P[j] * PR[i - j]; } PR[i] = r / P[0]; } PR[6] = 1; for (int i = 1; i <= 5; i++) PR[6] -= PR[i]; for (int i = 6; i < N; i++) { for (int j = 1; j <= 6; j++) { P[i] += P[i - j] * PR[j]; } } vector E(N, 0); E[1] = 1.0; for (int i = 1; i < N; i++) { E[i + 1] = E[i] + P[i]; } int T; cin >> T; for (int i = 0; i < T; i++) { int n; cin >> n; printf("%.12f\n", E[n]); } } } int main() { input(); solve(); return 0; }