#include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< pii; typedef vector vi; typedef vector vll; ll N; double calc(double x){ vector dp(N + 1, 0); for(int i = 1; i <= N; ++i){ for(int j = 1; j <= 6; ++j){ if(i - j < 0)dp[i] += x; else dp[i] += dp[i - j]; } dp[i] = dp[i] / 6 + 1; } return dp[N]; } double solve(){ double L = 0.0, R = 1e10, M; rep(i, 100){ M = (L + R) / 2; (calc(M) >= M ? L : R) = M; } return L; } int main(){ int T; cin >> T; while(~scanf("%lld", &N)){ if(N < 1000)printf("%0.20f\n", solve()); else printf("%lld%s\n", N + 1, ".6666666666666666666"); } }