#include #define EPS 1e-9 #define INF 1070000000LL #define MOD 1000000007LL #define fir first #define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++) #define numa(x,a) for(auto x: a) #define ite iterator #define mp make_pair #define rep(i,n) rep2(i,0,n) #define rep2(i,m,n) for(int i=m;i<(n);i++) #define pb push_back #define pf push_front #define sec second #define sz(x) ((int)(x).size()) #define ALL( c ) (c).begin(), (c).end() #define gcd(a,b) __gcd(a,b) #define mem(x,n) memset(x,n,sizeof(x)) #define endl "\n" using namespace std; template void deploy(std::ostream &os, const TUPLE &tuple){} template void deploy(std::ostream &os, const TUPLE &t){ os << (POS == 0 ? "" : ", ") << get(t); deploy(os, t); } template std::ostream& operator<<(std::ostream &os, std::pair &p){ os << "(" << p.first <<", " << p.second <<")";return os; } template std::ostream& operator<<(std::ostream &os, std::vector &v){ int remain = v.size(); os << "{"; for(auto e: v) os << e << (--remain == 0 ? "}" : ", "); return os; } template std::ostream& operator<<(std::ostream &os, std::set &v){ int remain = v.size(); os << "{"; for(auto e: v) os << e << (--remain == 0 ? "}" : ", "); return os; } template std::ostream& operator<<(std::ostream &os, std::map &mp){ int remain = mp.size(); os << "{"; for(auto e: mp) os << "(" << e.first << " -> " << e.second << ")" << (--remain == 0 ? "}" : ", "); return os; } #define DEBUG1(var0) { std::cerr << (#var0) << "=" << (var0) << endl; } #define DEBUG2(var0, var1) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG1(var1); } #define DEBUG3(var0, var1, var2) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG2(var1,var2); } #define DEBUG4(var0, var1, var2, var3) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG3(var1,var2,var3); } using ll = long long; #define TEETH 14 int A; int goal; double P[3]; double memo[22][TEETH+1]; inline bool bit_stand(int b, int i){ return (b&(1<b2に遷移する確率 double ret = 1; for (int i = 0; i < TEETH; i++) { if (bit_stand(b,i) != bit_stand(b2,i)) {//虫歯になりました ret *= calc2(b,i); }else if(bit_stand(b2,i)){//健康なまま ret *= 1 - calc2(b,i); } } return ret; } inline vector split(int b){//連続したところを切り出す int now = 0; vector ret; for (int i = 0; i < TEETH; i++) { if (bit_stand(b,i)){ now += 1; }else{ if (now > 0) { ret.pb(now); now = 0; } } } if (now > 0) { ret.pb(now); } return ret; } double dp_go(int now, int now_teeth){ if (now == goal) { return now_teeth; } if (memo[now][now_teeth] >= 0) { return memo[now][now_teeth]; } double ret = 0; int bit = (1 << now_teeth) - 1; for(int T=bit; T>0; T=(T-1)&bit){ //TはSの部分集合(S含む、0含まない) auto p = calc(bit,T); auto seq = split(T); numa(x,seq){ ret += p * dp_go(now+1,x); } } return memo[now][now_teeth] = ret; } int main() { cin.tie(0); ios_base::sync_with_stdio(0); cin >> A; rep(i,3){ cin >> P[i]; P[i] /= 100; } rep(i,22){ rep(j,TEETH+1){ memo[i][j] = -1; } } goal = 80-A; //上下の歯は独立と考えて良い cout << fixed << setprecision(10) << 2 * dp_go(0,TEETH) << endl; return 0; }