#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 nth, bool preExist, int mask, double dp[YEAR][TEETH][2][MASK]) { double &ret = dp[year][nth][preExist][mask]; if (ret > -0.5) return ret; if (year == limit) { return ret = __builtin_popcount(mask); } if (nth == TEETH) return ret = rec(year + 1, 0, 0, mask, dp); if (!(mask & (1 << nth))) return ret = rec(year, nth + 1, 0, mask, dp); int nMissing = 0; nMissing += (nth == 0 || !preExist); nMissing += (nth == TEETH - 1 || !(mask & (1 << (nth + 1)))); ret = 0; ret += p[nMissing] * rec(year, nth + 1, 1, mask & ~(1 << nth), dp); ret += (1 - p[nMissing]) * rec(year, nth + 1, 1, mask , dp); return ret; } void work() { static double dp[YEAR][TEETH][2][MASK]; for (int i = 0; i < YEAR; ++i) for (int j = 0; j < TEETH; ++j) for (int k = 0; k < 2; ++k) for (int l = 0; l < MASK; ++l) dp[i][j][k][l] = -1; printf("%.10lf\n", rec(0, 0, 0, (1 << TEETH) - 1, dp) * 2); } int main() { read(); work(); return 0; }