#include #include #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,j) FOR(i,0,j) int M; double S[1024], dp[11][1024]; bool calculated[11][1024]; // indexがstageで勝つ確率(l, rはどこまでか) double rec(int index, int stage, int l, int r){ if(stage == M){return 1.0f;} if(calculated[stage][index]){return dp[stage][index];} int mid = (l+r) / 2; double res = 0.0f; if(l <= index && index < mid){ FOR(i, mid, r){ res += rec(i, stage+1, mid, r) * S[index] / (S[index] + S[i]); } res *= rec(index, stage+1, l, mid); }else{ FOR(i, l, mid){ res += rec(i, stage+1, l, mid) * S[index] / (S[index] + S[i]); } res *= rec(index, stage+1, mid, r); } calculated[stage][index] = true; return dp[stage][index] = res; } int main(){ std::cin >> M; REP(i, 1<> S[i]; S[i] *= S[i]; } printf("%.8f\n", rec(0, 0, 0, 1<