def solve(M, S): DP = [[0] * (M + 1) for i in range(len(S))] for i in range(len(S)): DP[i][0] = 1.0 for j in range(1, M + 1): step = 2 ** j for i in range(len(S)): l = (i // step) * step r = l + step if i - l >= r - i: r = (l + r) // 2 else: l = (l + r) // 2 DP[i][j] = 0.0 for k in range(l, r): DP[i][j] += S[i] / (S[i] + S[k]) * DP[k][j - 1] DP[i][j] *= DP[i][j - 1] return DP[0][M] def main(): M = int(input()) n = 2 ** M S = [int(input()) ** 2 for i in range(n)] print(solve(M, S)) if __name__ == '__main__': main() # 解説をちら見してから考えたやつ