// Wrongri-La Shower #include #include typedef std::pair Pair; double P[3]; // 虫歯に「なる」確率 std::vector ns[1<<14]; double dp[21][1<<14]; double probability(int prev, int next){ double res = 1.0; for(int i=0;i<14;i++){ if(!(prev >> i & 1)){continue;} double p; if(i == 0){ p = P[prev >> 1 & 1]; }else if(i == 13){ p = P[prev >> 12 & 1]; }else{ p = P[(prev >> i-1 & 1) + (prev >> i+1 & 1)]; } res *= next >> i & 1 ? 1.0-p : p; } return res; } int main(){ int N; scanf("%d", &N); N = 80-N; scanf("%lf %lf %lf", P, P+1, P+2); for(int i=0;i<3;i++){P[i] /= 100;} for(int i=0;i<1<<14;i++){ for(int j=0;j<1<<14;j++){ if((i & j) != j){continue;} ns[i].push_back(std::make_pair(j, probability(i, j))); } } dp[0][(1<<14)-1] = 1.0; for(int i=0;i