#pragma region TEMP #include using namespace std; //#include //using namespace atcoder; using ll = long long; using ld = long double; using ull = unsigned long long; using pii = pair; using pll = pair; using pli = pair; using pdd = pair; const ll LINF=0x1fffffffffffffff; const ll MINF=0x7fffffffffff; const int INF=0x3fffffff; const ld DINF=numeric_limits::infinity(); const int MOD=1000000007; const int MODD=998244353; const ld EPS=1e-9; const ld PI=3.1415926535897932; const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}; const int dy[] = {1, 0, -1, 0, 1, 1, -1, -1}; #define vec vector #define elif else if #define endl '\n' #define setpre cout << fixed << setprecision(15); #define overload5(a,b,c,d,e,name,...) name #define overload4(a,b,c,d,name,...) name #define overload3(a,b,c,name,...) name #define rep1(n) for(ll i=0;i<(ll)(n);i++) #define rep2(i,n) for(ll i=0;i<(ll)(n);i++) #define rep3(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++) #define rep4(i,a,b,c) for(ll i=(ll)(a);i<(ll)(b);i+=(ll)(c)) #define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__) #define rrep1(n) for(ll i=(ll)(n);i--;) #define rrep2(i,n) for(ll i=(ll)(n);i--;) #define rrep3(i,a,b) for(ll i=(ll)(b);i-->(ll)(a);) #define rrep4(i,a,b,c) for(ll i=(ll)(a)+((ll)(b)-(ll)(a)-1)/(ll)(c)*(ll)(c);i>=(ll)(a);i-=(ll)(c);) #define rrep(...) overload4(__VA_ARGS__,rrep4,rrep3,rrep2,rrep1)(__VA_ARGS__) #define each1(a,v) for(auto &&a:v) #define each2(a,b,v) for(auto &&[a,b]:v) #define each3(a,b,c,v) for(auto &&[a,b,c]:v) #define each4(a,b,c,d,v) for(auto &&[a,b,c,d]:v) #define each(...) overload5(__VA_ARGS__,each4,each3,each2,each1)(__VA_ARGS__) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define Sz(x) (x).size() #define Sort(x) sort(all(x)) #define rSort(x) sort(rall(x)) #define Rev(x) reverse(all(x)) template auto min(const T& a){ return *min_element(all(a));} template auto max(const T& a){ return *max_element(all(a));} template bool chmin(T& a, const T& b){if(a>b){a=b;return 1;}return 0;} template bool chmax(T& a, const T& b){if(a bool chmin(T& a, const U& b){if(a>b){a=b;return 1;}return 0;} template bool chmax(T& a, const U& b){if(a using PQ = priority_queue>; template using PQG = priority_queue, greater>; ll intpow(ll m, ll n){ll res=1;while(n>0){if(n&1)res=res*m;m=m*m;n>>=1;}return res;} ll modpow(ll m, ll n){ll res=1;while(n>0){if(n&1)res=res*m%MOD;m=m*m%MOD;n>>=1;}return res;} #pragma endregion TEMP int main() { ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; vec p = {1.0/12, 1.0/6, 1.0/4, 1.0/12, 1.0/4, 1.0/6}; rep(ii, t) { int n; cin >> n; vec dp(n, 0); rep(i, n) { ld tmp = 0; rep(j, 6) { if (i-j-1 < 0) continue; tmp += dp[i-j-1]*p[j]; } dp[i] = 1+tmp; } setpre; cout << dp[n-1] << endl; } return 0; }