#include using namespace std; #if __has_include() #include using namespace atcoder; templateistream &operator>>(istream &is,static_modint &a){long long b;is>>b;a=b;return is;} istream &operator>>(istream &is,modint &a){long long b;cin>>b;a=b;return is;} #endif using ll=long long; using ull=unsigned long long; using P=pair; templateusing minque=priority_queue,greater>; templatebool chmax(T &a,const T &b){return (abool chmin(T &a,const T &b){return (a>b?(a=b,true):false);} templateistream &operator>>(istream &is,pair&p){is>>p.first>>p.second;return is;} templateistream &operator>>(istream &is,vector &a){for(auto &i:a)is>>i;return is;} templatevoid operator++(pair&a,int n){a.first++,a.second++;} templatevoid operator--(pair&a,int n){a.first--,a.second--;} templatevoid operator++(vector&a,int n){for(auto &i:a)i++;} templatevoid operator--(vector&a,int n){for(auto &i:a)i--;} #define reps(i,a,n) for(int i=(a);i<(n);i++) #define rep(i,n) reps(i,0,n) #define all(x) x.begin(),x.end() #define pcnt(x) __builtin_popcount(x) ll myceil(ll a,ll b){return (a+b-1)/b;} #ifdef LOCAL #include "debug.h" #else #define debug(...) static_cast(0) templateostream &operator<<(ostream &os,const pair&p){os<>testcase; for(int i=0;i struct Matrix{ vector>A; Matrix(int h,int w):A(h,vector(w,0)){} Matrix(int n):A(n,vector(n,0)){} size_t height()const{return A.size();} size_t width()const{return A[0].size();} const vector &operator[](int k)const{return (A.at(k));} vector &operator[](int k){return (A.at(k));} Matrix I(size_t n){ Matrix m(n); rep(i,n)m[i][i]=1; return m; } Matrix &operator+=(const Matrix &B){ size_t h=height(),w=width(); assert(h==B.height()); assert(w==B.width()); rep(i,h)rep(j,w)(*this)[i][j]+=B[i][j]; return *this; } Matrix &operator-=(const Matrix &B){ size_t h=height(),w=width(); assert(h==B.height()); assert(w==B.width()); rep(i,h)rep(j,w)(*this)[i][j]-=B[i][j]; return *this; } Matrix &operator*=(const Matrix &B){ size_t h=height(),w=B.width(),p=width(); assert(B.height()==p); vector>C(h,vector(w,0)); rep(i,h)rep(k,p)rep(j,w)C[i][j]=(C[i][j]+(*this)[i][k]*B[k][j]); A.swap(C); return *this; } Matrix &operator^=(ll k){ assert(height()==width()); assert(k>=0); Matrix B=I(height()); while(k){ if(k&1)B*=*this; *this *= *this; k>>=1ll; } A.swap(B.A); return *this; } Matrix operator+(const Matrix &B)const{ return (Matrix(*this)+=B); } Matrix operator-(const Matrix &B)const{ return (Matrix(*this)-=B); } Matrix operator*(const Matrix &B)const{ return (Matrix(*this)*=B); } Matrix operator^(const ll k)const{ return (Matrix(*this)^=k); } T det(){ Matrixb(*this); assert(this->height()==this->width()); T ret=1; rep(i,width()){ int id=-1; reps(j,i,width()){ if(b[j][i]!=0)id=j; } if(id==-1)return 0; if(i!=id){ ret*=-1; swap(b[i],b[id]); } ret*=b[i][i]; T inv=b[i][i].inv(); rep(j,width()){ b[i][j]*=inv; } reps(j,i+1,width()){ T x=b[j][i]; rep(k,width()){ b[j][k]-=b[i][k]*x; } } } return ret; } Matrix inv(){ assert(this->height()==this->width()); int n=this->height(); Matrixb(*this); Matrixret=I(n); rep(i,n){ int id=-1; reps(j,i,n){ if(b[j][i]!=0)id=j; } assert(id!=-1); if(i!=id){ swap(b[i],b[id]); swap(ret[i],ret[id]); } T inv=(double)1/b[i][i]; rep(j,n){ b[i][j]*=inv; ret[i][j]*=inv; } rep(j,n)if(i!=j){ T x=b[j][i]; rep(k,n){ b[j][k]-=b[i][k]*x; ret[j][k]-=ret[i][k]*x; } } } return ret; } }; void SOLVE(){ int k; cin>>k; Matrixmat(k); rep(i,k)reps(j,1,7){ if(i+jI(k); rep(i,k)I[i][i]=1; mat=I-mat; mat=mat.inv(); mat*=mat; double ans=0; reps(i,1,7)if(k-i>=0)ans+=mat[0][k-i]/6; cout<