#include using namespace std; #define reps(i,s,n) for(int i = s; i < n; i++) #define rep(i,n) reps(i,0,n) #define Rreps(i,n,e) for(int i = n - 1; i >= e; --i) #define Rrep(i,n) Rreps(i,n,0) #define ALL(a) a.begin(), a.end() #define fi first #define se second typedef long long ll; typedef vector vec; typedef vector mat; ll N,M,H,W,Q,K,A,B; string S; //const ll MOD = 998244353; const ll MOD = (1e+9) + 7; typedef pair P; const ll INF = (1LL<<58); template bool chmin(T &a, const T &b){ if(a > b) {a = b; return true;} else return false; } template bool chmax(T &a, const T &b){ if(a < b) {a = b; return true;} else return false; } ll encode(vec &v){ ll res = 0; Rrep(i,N){ (res *= 3)+=v[i]; } return res; } void decode(vec &v, vec &zero, ll code){ rep(i,N){ v.push_back(code%3); if(code%3 == 0) zero.push_back(i); code/=3; } } void check(vec &state, long double p){ rep(i,N) cout<<(state[i] ? (state[i] == 1 ? 'n' : 'k') : '0')<<' '; cout< > &dp, vec &a, int turn, ll code){ if(dp[turn][code] > -0.5) return dp[turn][code]; vec state(0), zero(0); decode(state, zero, code); if(zero.empty()){ ll score = 0; rep(i,N) score += (state[i] == 1 ? a[i] : -a[i]); //if(debug) check(state, (long double)score); return dp[turn][code] = (score > 0 ? 1 : 0); } if(turn) dp[turn][code] = 1.0; for(int i : zero){ long double memo = 1 - turn; for(int j : zero){ long double temp = 0; if(i == j){ long double p = 1.0 / (2.0 - 1.0 / a[i]); if(turn) p = 1.0 - p; state[i] = 1; temp += p * dfs(dp, a, 1, encode(state)); state[i] = 2; temp += (1.0 - p) * dfs(dp, a, 0, encode(state)); state[i] = 0; }else{ long double p = 1.0 / (1.0 + ((long double)a[i] - 1.0) / a[j]); state[i] = 1 + turn; temp += p * dfs(dp, a, 1 - turn, encode(state)); state[i] = 0; state[j] = 2 - turn; temp += (1.0 - p) * dfs(dp, a, turn, encode(state)); state[j] = 0; } if(code == 0 && debug) cout<>N; vec a(N); rep(i,N) cin>>a[i]; ll n3 = 1; rep(i,N) n3 *= 3; vector > dp(2, vector(n3, -1)); dfs(dp, a, 0, 0); cout<