import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int M = sc.nextInt(); int[] s = new int[(int)Math.pow(2, M) + 1]; for(int i = 1; i < s.length; i++) { s[i] = sc.nextInt(); } int num = s.length; // dp[j][i]は選手iがj回戦に勝つ確率 double[][] dp = new double[M + 1][num]; for(int i = 1; i < num; i++) { int aite = i + 1; if(i % 2 == 0) aite = i - 1; dp[1][i] = (double)(s[i] * s[i]) / (double)(s[i] * s[i] + s[aite] * s[aite]); } for(int j = 2; j <= M; j++) { for(int i = 1; i < num; i++) { int k = (i + (int)Math.pow(2, j - 1) - 1) / (int)Math.pow(2, j - 1); int aite = k + 1; if(k % 2 == 0) aite = k - 1; double p = 0; for(int l = (int)Math.pow(2, j - 1) * (aite - 1) + 1; l <= (int)Math.pow(2, j - 1) * aite; l++) { p += (dp[j - 1][l] * ((double)(s[i] * s[i]) / (double)(s[i] * s[i] + s[l] * s[l]))); } dp[j][i] = dp[j - 1][i] * p; } } System.out.println(dp[M][1]); } }