#include <bits/stdc++.h>
constexpr int MAX_TEAMS = 100;
constexpr int MAX_N = 8;
using namespace std;
int n, teams;
long double prob[MAX_TEAMS][MAX_TEAMS];
long double chance[MAX_N][MAX_TEAMS];
long double dp[MAX_N][MAX_TEAMS];
int pow2(int a) { return (1 << a); }
int main() {
  scanf(" %d", &n);
  teams = pow2(n);
  for (int i = 0; i < teams; i++) {
    for (int j = 0; j < teams; j++) {
      int x;
      scanf(" %d", &x);
      prob[i][j] = ((long double)x) / 100;
    }
  }
  for (int team = 0; team < teams; team++) {
    chance[0][team] = 1;
  }
  for (int round = 1; round <= n; round++) {
    int num_games = pow2(n - round);
    int round_pow = pow2(round);
    for (int game = 0; game < num_games; game++) {
      for (int team = game * round_pow; team < game * round_pow + round_pow / 2;
           team++) {
        for (int other = game * round_pow + round_pow / 2;
             other < game * round_pow + round_pow; other++) {
          chance[round][team] += chance[round - 1][team] *
                                 chance[round - 1][other] * prob[team][other];
        }
      }
      for (int team = game * round_pow + round_pow / 2;
           team < game * round_pow + round_pow; team++) {
        for (int other = game * round_pow;
             other < game * round_pow + round_pow / 2; other++) {
          chance[round][team] += chance[round - 1][team] *
                                 chance[round - 1][other] * prob[team][other];
        }
      }
    }
  }
  for (int round = 1; round <= n; round++) {
    for (int team = 0; team < teams; team++) {
      int round_pow = pow2(round);
      int game = team / round_pow;
      int other_start;
      int other_end;
      if (team < game * round_pow + round_pow / 2) {
        other_start = game * round_pow + round_pow / 2;
        other_end = game * round_pow + round_pow;
      } else {
        other_start = game * round_pow;
        other_end = game * round_pow + round_pow / 2;
      }
      int weight = pow2(round - 1);
      for (int other = other_start; other < other_end; other++) {
        dp[round][team] = max(dp[round][team], dp[round - 1][other]);
      }
      dp[round][team] += dp[round - 1][team] + weight * chance[round][team];
    }
  }
  long double ans = 0;
  for (int team = 0; team < teams; team++) {
    ans = max(ans, dp[n][team]);
  }
  printf("%0.10Lf\n", ans);
  return 0;
}
