#include <bits/stdc++.h>
using namespace std;
int n;
int m;
int fie[101][101];
long double win[101][8];
long double wg[101][8];
long double dp[101][8];
bool used[101][101];
bool used2[101][101];
long double ans = 0.0;
int main(void) {
  scanf("%d", &n);
  m = (1 << n);
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &fie[i][j]);
    }
  }
  for (int i = 0; i < m; i++) {
    win[i][0] = 1.00;
  }
  memset(used, false, sizeof(used));
  for (int i = 0; i < n; i++) {
    int wid = (1 << (i + 1));
    for (int j = 0; j < m; j++) {
      for (int k = 0; k < m; k++) {
        if (j / wid == k / wid && !used[j][k]) {
          used[j][k] = true;
          if (win[j][i] * win[k][i] * (long double)fie[j][k] / 100.0 > 1e-12) {
            win[j][i + 1] +=
                win[j][i] * win[k][i] * (long double)fie[j][k] / 100.0;
          }
        }
      }
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j <= n; j++) {
      wg[i][j] = (long double)win[i][j] * (1 << max(j - 1, 0));
      if (j == 0) wg[i][j] = 0;
      if (j > 0 && wg[i][j - 1] > 1e-12) wg[i][j] += (long double)wg[i][j - 1];
    }
  }
  for (int i = 0; i < m; i++) {
    dp[i][1] = win[i][1];
  }
  memset(used, false, sizeof(used));
  for (int i = 0; i < n; i++) {
    int wid = (1 << (i + 1));
    for (int j = 0; j < m; j++) {
      long double sum = 0.0;
      long double sum2 = 0.0;
      for (int k = 0; k < m; k++) {
        if (j / wid == k / wid && !used[j][k]) {
          used[j][k] = true;
          if (i == 0)
            ;
          else {
            dp[j][i + 1] =
                max(dp[j][i + 1], dp[j][i] + dp[k][i] +
                                      win[j][i + 1] * (long double)(1 << i));
            sum += dp[k][i - 1];
          }
        }
      }
    }
  }
  long double ans = 0.0;
  for (int i = 0; i < m; i++) {
    ans = max(ans, dp[i][n]);
  }
  printf("%.10f\n", (double)ans);
  return 0;
}
