import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; public class Main { public static long MOD = 1000000007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int M = sc.nextInt(); final int size = 1 << M; double[] power = new double[size]; for(int i = 0; i < size; i++){ power[i] = sc.nextDouble(); } final int DP_size = 2 * size - 1; double[][] DP = new double[DP_size][size]; for(int i = 0; i < size; i++){ final int index = i + (size - 1); DP[index][i] = 1.0; } for(int curr = size - 2; curr >= 0; curr--){ for(int left = 0; left < size; left++){ final int left_curr = curr * 2 + 1; if(DP[left_curr][left] == 0){ continue; } for(int right = left; right < size; right++){ final int right_curr = curr * 2 + 2; if(DP[right_curr][right] == 0){ continue; } final double left_d = power[left] * power[left]; final double right_d = power[right] * power[right]; final double left_win_rate = left_d / (left_d + right_d); final double right_win_rate = right_d / (left_d + right_d); //System.out.println(curr + " " + left + " " + right + " : " + left_win_rate + " " + right_win_rate); DP[curr][left] += DP[left_curr][left] * DP[right_curr][right] * left_win_rate; DP[curr][right] += DP[left_curr][left] * DP[right_curr][right] * right_win_rate; } } //System.out.println(Arrays.toString(DP[curr])); } System.out.printf("%.8f\n", DP[0][0]); } }