#include #include #include using namespace std; //derived from checkio expected-dice //unfortunately TLE using Python, rewriting in C++11. bool gauss(vector > &a){ if(a.empty())return false; int n=a.size(); for(int i=0;i b){ //perform checkio probably-dice vector a(s*(n+1)+1); for(int i=1;i<=s;i++)a[i+s]=pow(1.0/s,n); for(int e=0;e=0;i--){ double sum=0; for(int j=i;j > A(l); for(int i=0;i=l)end=0; A[start][end]-=a[roll+s]; } } gauss(A); return A[0][A[0].size()-1]; } int main(){ int T; for(scanf("%d",&T);T--;) { long long N; scanf("%lld",&N); if(N>200)printf("%.15f\n",N+5.0/3); else printf("%.15f\n",expected(1,6,N)); } }