#include #include #include using namespace std; typedef long long ll; typedef double ld; int T; ll k; ld p=1; vector > powmat[64]; vector > matmul(vector >& a, vector >& b) { int n = a.size(); vector > c(n, vector(n)); for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) for (int k = 0; k < n; k++) c[i][j] = (c[i][j] + (ld)a[i][k] * b[k][j]); return c; } vector > matpow(ll k) { vector > ret(7, vector(7)); for (int i = 0; i < 7; i++) ret[i][i] = 1; for(int i=0;i<64;i++) if((k>>i&1)==1)ret=matmul(ret,powmat[i]); return ret; } void otaku(vector > mat){ powmat[0]=mat; for(int i=1;i<64;i++) powmat[i]=matmul(powmat[i-1],powmat[i-1]); } int main(){ p/=6; cout<>T; vector > mat(7, vector(7)); for(int i=0;i<5;i++) mat[i][i+1]=1.0; for(int i=0;i<6;i++) mat[5][i]=p; mat[5][6]=mat[6][6]=1; otaku(mat); for(int _=0;_>k; if(k<1000000000){ vector > ret=matpow(k); ld ggg=ret[5][6]; ld fff=0.0; for(int i=0;i<5;i++) fff+=ret[5][i]; cout<