#include using namespace std; using ld = long double; int n; // e0を仮定してにぶたん bool le(const ld e0){ vector e(n+1); for(int i = n-1; i >= 0; i--){ for(int j = i+1; j <= i+6; j++){ if(j > n){ e[i] += (e0+1) / 6; } else { e[i] += (e[j]+1) / 6; } } } return e0 < e[0]; } ld solve(){ if(n > 700) return n + 5./3; ld lo = 0; ld hi = 1e9; for(int _ = 0; _ < 60; ++_){ ld mid = (lo + hi) / 2; if(le(mid)) lo = mid; else hi = mid; } return lo; } int main(){ int t; cin >> t; while(t--){ cin >> n; printf("%.20lf\n", (double)solve()); } }