#include typedef long long ll; typedef unsigned long long ull; using namespace std; #define pb push_back int dy[]={0, 0, 1, -1, 1, 1, -1, -1}; int dx[]={1, -1, 0, 0, 1, -1, -1, 1}; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define mp make_pair #define fi first #define sc second int n; double memo[2000000]; bool done[2000000]; double p[]={0.0,0.083333333333333,0.166666666666667,0.250000000000000,0.083333333333333,0.250000000000000,0.166666666666667}; double saiki(int x){ if(done[x]) return memo[x]; done[x] = true; if(x >= n) return memo[x] = 0.0; double sum = 1.0; FOR(i,1,7) sum += saiki(x + i) * p[i]; return memo[x] = sum; } int main(){ n = 1000010; REP(i,n + 10) done[i] = false; saiki(0); int t; scanf("%d",&t); REP(i,t){ scanf("%d",&n); printf("%lf\n",memo[1000010 - n]); } return 0; }