#include #include #include #include #include #include #include #include #include #include #include #include #include #define repd(i,a,b) for (int i=(a);i<(b);i++) #define rep(i,n) repd(i,0,n) #define var auto #define mod 1000000007 #define inf 2147483647 #define nil -1 typedef long long ll; using namespace std; inline int input(){ int a; cin >> a; return a; } template inline void output(T a, int p) { if(p){ cout << fixed << setprecision(p) << a << "\n"; } else{ cout << a << "\n"; } } double solve_small(int n){ vector a(n + 7, 0); vector b(n + 7, 0); rep(i, 6){ a[n + i + 1] = 1; } for (int i = n - 1; i >= 0; i--) { rep(j, 6){ a[i] += a[i + j + 1]; b[i] += b[i + j + 1]; } a[i] /= 6; b[i] /= 6; b[i] += 1; } // cout << "a0 = " << a[0] << endl; // cout << "b0 = " << b[0] << endl; return b[0] / (1 - a[0]); } double solve_large(int n){ return double(n) + 5.0 / 3; } // end of template int main() { cin.tie(0); // source code int T = input(); rep(i, T){ int N = input(); if (N < 500) { output(solve_small(N), 15); } else{ output(solve_large(N), 15); } } return 0; }