#include <bits/stdc++.h>
using namespace std;
int N, n;
double p[65][65];
double bhere[6][65];
double expnt[6][65];
double pref[10][65];
bool vis[65][65][10];
double dp[65][65][10];
double f(int l, int r, int c, int p) {
  if (l == r) return pref[c][l];
  if (vis[l][r][c]) return dp[l][r][c];
  vis[l][r][c] = true;
  double tr = max(
      f(l, ((l + r) / 2), c, p - 1) + f(((l + r) / 2) + 1, r, p - 1, p - 1),
      f(l, ((l + r) / 2), p - 1, p - 1) + f(((l + r) / 2) + 1, r, c, p - 1));
  return dp[l][r][c] = tr;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N;
  n = pow(2, N);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> p[i][j];
      p[i][j] /= 100;
    }
  }
  for (int i = 0; i < n; i++) bhere[0][i] = 1;
  double ans = 0;
  for (int i = 0; i < n; i++) pref[0][i] = 0;
  for (int i = 0; i < N; i++) {
    int brack = pow(2, i);
    for (int j = 0; j < n; j++) {
      int turn = j / brack;
      if (turn % 2) {
        j = ((turn + 1) * brack) - 1;
        continue;
      }
      int st = ((turn + 1) * brack);
      int en = ((turn + 2) * brack);
      for (int k = st; k < en; k++) {
        if (i < (N - 1)) {
          bhere[i + 1][j] += (bhere[i][j] * bhere[i][k]) * p[j][k];
          bhere[i + 1][k] += (bhere[i][j] * bhere[i][k]) * p[k][j];
        }
        expnt[i][j] += ((bhere[i][j] * bhere[i][k]) * p[j][k]) * pow(2, i);
        expnt[i][k] += (bhere[i][j] * bhere[i][k]) * p[k][j] * pow(2, i);
        pref[i + 1][j] = pref[i][j] + expnt[i][j];
        pref[i + 1][k] = pref[i][k] + expnt[i][k];
      }
    }
  }
  cout << fixed << setprecision(9) << f(0, pow(2, N) - 1, N, N) << "\n";
  return 0;
}
