#include <bits/stdc++.h>
using namespace std;
double dp[8][66], prob[8][66];
int n, tt, s[66][66];
int main() {
  scanf("%d", &n);
  tt = (1 << n);
  for (int i = (0); i <= (tt - 1); i++)
    for (int j = (0); j <= (tt - 1); j++) scanf("%d", &s[i][j]);
  for (int i = (0); i <= (tt - 1); i++) prob[n + 1][i] = 1;
  for (int i = (n); i >= (1); i--) {
    int wid = 1 << (n - i);
    for (int j = 0; j < tt; j += wid * 2) {
      int j2 = j + wid;
      for (int k = (j); k <= (j + wid - 1); k++)
        for (int l = (j2); l <= (j2 + wid - 1); l++) {
          prob[i][k] += prob[i + 1][k] * prob[i + 1][l] * (s[k][l] / 100.0);
          prob[i][l] += prob[i + 1][k] * prob[i + 1][l] * (s[l][k] / 100.0);
        }
    }
    for (int j = 0; j < tt; j += wid * 2) {
      int j2 = j + wid;
      for (int k = (j); k <= (j + wid - 1); k++)
        for (int l = (j2); l <= (j2 + wid - 1); l++) {
          dp[i][k] =
              max(dp[i][k], dp[i + 1][k] + dp[i + 1][l] + wid * prob[i][k]);
          dp[i][l] =
              max(dp[i][l], dp[i + 1][l] + dp[i + 1][k] + wid * prob[i][l]);
        }
    }
  }
  double res = 0;
  for (int i = (0); i <= (tt - 1); i++) res = max(res, dp[1][i]);
  printf("%.10lf\n", res);
  return 0;
}
