#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i)) #define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i)) #define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i)) #define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i)) #define ALL(x) ::std::begin(x), ::std::end(x) using namespace std; auto solve(int n, const vector<int> & a) { vector<int> pow_3(n + 1); pow_3[0] = 1; REP (i, n) { pow_3[i + 1] = pow_3[i] * 3; } vector<array<double, 2> > dp(pow_3[n]); REP_R (state, pow_3[n]) { int available = 0; int score = 0; { // unpack int s = state; REP (i, n) { if (s % 3 == 0) { available |= 1 << i; } else if (s % 3 == 1) { score += a[i]; } else { score -= a[i]; } s /= 3; } } if (not available) { dp[state][false] = score > 0; dp[state][true] = score <= 0; } else { REP (turn, 2) { REP (i, n) if (available & (1 << i)) { double prob = 1; REP (j, n) if (available & (1 << j)) { double p = 1.0 / a[i]; double q = 1.0 / a[j]; if (a[i] == 1) { double x = 1 - dp[state + (turn + 1) * pow_3[i]][not turn]; prob = min(prob, x); } else if (a[j] == 1) { double x = p * (1 - dp[state + (turn + 1) * pow_3[i]][not turn]); double y = (1 - p) * dp[state + (not turn + 1) * pow_3[j]][turn]; prob = min(prob, x + y); } else { double x = p * (1 - dp[state + (turn + 1) * pow_3[i]][not turn]); double y = (1 - p) * q * dp[state + (not turn + 1) * pow_3[j]][turn]; double r = (1 - p) * (1 - q); prob = min(prob, (x + y) / (1 - r)); } } dp[state][turn] = max(dp[state][turn], prob); } } } } return dp[0][false]; } int main() { int n; cin >> n; vector<int> a(n); REP (i, n) { cin >> a[i]; } auto ans = solve(n, a); cout << setprecision(18) << ans << endl; return 0; }