#include #include #include #include using namespace std; int main() { int m; cin >> m; int playerCount = (1 << m); vector s(1 + playerCount); for (int i = 1; i <= playerCount; ++i) { cin >> s[i]; } // [?-th round][?-th player] vector > p(1 + m, vector(1 + playerCount)); fill(p[0].begin(), p[0].end(), 1.0); for (int round = 1; round <= m; ++round) { for (int k = 1; k <= playerCount; ++k) { double sum = 0; int game = (k - 1) / (1 << round); int previousGame = (k - 1) / (1 << (round - 1)); for (int m = game * (1 << round) + 1; m <= (game + 1) * (1 << round); ++m) { if (m < previousGame * (1 << (round - 1)) + 1 || (previousGame + 1) * (1 << (round - 1)) + 1 <= m) { double conditional = s[k] * s[k] / (s[k] * s[k] + s[m] * s[m]); sum += conditional * p[round - 1][m]; } } p[round][k] = p[round - 1][k] * sum; } } cout << fixed << setprecision(12) << p[m][1] << endl; return 0; }