#include #include #include #include #include using namespace std; #define REP(i,s,e) for (i = s; i <= e; i++) #define rep(i,n) REP (i,0,(int)(n)-1) #define RREP(i,s,e) for (i = s; i >= e; i--) #define rrep(i,n) RREP (i,(int)(n)-1,0) #define INF (int)1e8 #define MOD (int)(1e9+7) typedef long long ll; struct M { long double mat[7][7] {}; void init() { for (int i = 0; i < 7; i++) mat[i][i] = 1; } void init2() { mat[0][0] = 1; for (int j = 0; j < 7; j++) mat[1][j] = 1./6; mat[1][0] = 1; for (int i = 0; i < 5; i++) mat[i+2][i+1] = 1; } M operator*(M& b) { M c; for (int i = 0; i < 7; i++) { for (int j = 0; j < 7; j++) { for (int k = 0; k < 7; k++) { c.mat[i][j] += mat[i][k] * b.mat[k][j]; } } } return c; } vector operator*(vector b) { vector c(7); for (int i = 0; i < 7; i++) { for (int j = 0; j < 7; j++) { c[i] += mat[i][j] * b[j]; } } return c; } void print() { for (int i = 0; i < 7; i++) { for (int j = 0; j < 7; j++) cout << mat[i][j] << " "; cout << endl; } } }; int main(void) { int t; ll n; cin >> t; while (t--) { cin >> n; if (n < 100000) { M a, b; a.init(); b.init2(); while (n) { if (n % 2) a = a * b; b = b * b; n /= 2; } vector c(7); long double l, r; l = 0; r = 1e10; for (int loop = 0; loop < 200; loop++) { long double m = (l+r)/2; c[0] = 1; c[1] = 0; for (int i = 2; i < 7; i++) c[i] = m; c = a * c; if (c[1] > m) l = m; else r = m; } cout << fixed << setprecision(13) << (l+r)/2 << endl; } else cout << (n+1) << ".666666666666" << endl; } return 0; }