#include #include using namespace std; const int YEAR = 21; const int TEETH = 14; const int MASK = 1 << TEETH; int limit; double p[3]; void read() { int age; cin >> age; limit = 80 - age; int pint0, pint1, pint2; cin >> pint0 >> pint1 >> pint2; p[2] = pint0 * 0.01; p[1] = pint1 * 0.01; p[0] = pint2 * 0.01; } double rec(int year, int mask, double dp[YEAR][MASK]) { double &ret = dp[year][mask]; if (ret > -0.5) return ret; if (mask == 0) { return 0; } if (year == limit) { return ret = __builtin_popcount(mask); } ret = 0; for (int nexMask = mask; nexMask; nexMask = (nexMask - 1) & mask) { double mul = 1; for (int i = 0; i < TEETH; ++i) { if (!(mask & (1 << i))) continue; int nMissing = 0; nMissing += (i == 0 || !(mask & (1 << (i - 1)))); nMissing += (i == TEETH - 1 || !(mask & (1 << (i + 1)))); if (nexMask & (1 << i)) { mul *= 1 - p[nMissing]; } else { mul *= p[nMissing]; } } ret += mul * rec(year + 1, nexMask, dp); } return ret; } void work() { static double dp[YEAR][MASK]; for (int i = 0; i < YEAR; ++i) for (int j = 0; j < MASK; ++j) dp[i][j] = -1; printf("%.10lf\n", rec(0, (1 << TEETH) - 1, dp) * 2); } int main() { read(); work(); return 0; }