#include using namespace std; int Q, N; bool vis[1000009]; double dp[1000009]; double r[] = { 1.0 / 12, 1.0 / 6, 1.0 / 4, 1.0 / 12, 1.0 / 4, 1.0 / 6 }; double rec(int x) { if(x <= 0) return 0.0; if(vis[x]) return dp[x]; double ret = 0.0; for(int i = 1; i <= 6; i++) ret += rec(x - i) * r[i - 1]; vis[x] = true; return dp[x] = ret + 1; } int main() { rec(1000); cin >> Q; while(Q--) { cin >> N; cout << fixed << setprecision(15) << dp[N] << endl; } return 0; }