#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) #define all(c) (c).begin(), (c).end() #define zero(a) memset(a, 0, sizeof a) #define minus(a) memset(a, -1, sizeof a) #define minimize(a, x) a = std::min(a, x) #define maximize(a, x) a = std::max(a, x) using ll = long long; int const inf = 1<<29; int N; double dp[1001]; double memo[1001]; double check(double x) { if(memo[N] >= 0) return memo[N]; REP(i, 1, N+1) { dp[i] = 0; REP(j, 1, 7) { if(i < j) { dp[i] += x; } else { dp[i] += dp[i-j]; } } dp[i] = 1 + dp[i] / 6.0; } return memo[N] = dp[N]; } int main() { minus(memo); int T; cin >> T; while(T--) { cin >> N; N = min(N, 1000); zero(dp); double l = 0, r = 100000; rep(i, 30) { double m = (l + r) / 2.0; if(m <= check(m)) { l = m; } else { r = m; } } printf("%.10f\n", l); } return 0; }