#include #include #include #include #include #include #include #include #include #include using namespace std; int k; long double memo[1000100]; int a,b,c,d,e,f; //x:これまでの和 //k以上になるのに必要な残り回数の期待値を返す double rec(int x){ if(memo[x]!=-1) return memo[x]; if(x>=k) return memo[x]=0.0; double res=0.0; if(a!=0)res+=rec(x+1)*(a/12.0); if(b!=0)res+=rec(x+2)*(b/12.0); if(c!=0)res+=rec(x+3)*(c/12.0); if(d!=0)res+=rec(x+4)*(d/12.0); if(e!=0)res+=rec(x+5)*(e/12.0); if(f!=0)res+=rec(x+6)*(f/12.0); return memo[x]=res+1.0; } int main() { double min=-1; double test[]={ 1.0000000000000000, 1.0833333333333333, 1.2569444444444444, 1.5353009259259260, 1.6915991512345676, 2.0513639724794235, 5.7894594000345325, 13.789629635263326, 27.122962962962941, 267.12296296296188 }; int num[]={1,2,3,4,5,6,20,50,100,1000}; int aa,bb,cc,dd,ee,ff; for(a=0;a<=12;a++){ for(b=0;b<=12;b++){ for(c=0;c<=12;c++){ for(d=0;d<=12;d++){ for(e=0;e<=12;e++){ for(f=0;f<=12;f++){ if(a+b+c+d+e+f!=12) continue; double x=0; for(int i=0;i<10;i++){ for(int j=0;j<10001;j++) memo[j]=-1; k=num[i]; x+=abs(rec(0)-test[i]); } if(min==-1 || min>x){min=x; aa=a; bb=b; cc=c; dd=d; ee=e; ff=f;} } } } } } } a=aa; b=bb; c=cc; d=dd; e=ee; f=ff; int t; cin>>t; for(int i=0;i>k; for(long j=0;j<1000100;j++) memo[j]=-1; printf("%.16f\n",rec(0)); } return 0; }