#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
double p[8][105], s[8][105], w[105][105];
int bl[8][105];
int bin[11], n;
int main() {
  bin[0] = 1;
  for (int i = 1; i <= 10; i++) bin[i] = bin[i - 1] * 2;
  n = read();
  for (int i = 1; i <= bin[n]; i++)
    for (int j = 1; j <= bin[n]; j++) w[i][j] = 0.01 * read();
  for (int i = 1; i <= bin[n]; i++) p[0][i] = 1.0, s[0][i] = 0.0;
  for (int i = 0; i <= n; i++) {
    int cnt = 0;
    for (int j = 1; j <= bin[n]; j += bin[i]) {
      cnt++;
      for (int k = j; k <= j + bin[i] - 1; k++) bl[i][k] = cnt;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= bin[n]; j++) {
      double now = 0.0;
      for (int k = 1; k <= bin[n]; k++)
        if (bl[i][j] == bl[i][k] && bl[i - 1][k] != bl[i - 1][j])
          now = now + p[i - 1][k] * w[j][k];
      p[i][j] = p[i - 1][j] * now;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= bin[n]; j++) {
      for (int k = 1; k <= bin[n]; k++)
        if (bl[i][j] == bl[i][k] && bl[i - 1][k] != bl[i - 1][j])
          s[i][j] = max(s[i][j],
                        s[i - 1][j] + s[i - 1][k] + p[i][j] * 1.0 * bin[i - 1]);
    }
  }
  double ans = 0.0;
  for (int i = 1; i <= bin[n]; i++) ans = max(ans, s[n][i]);
  printf("%.20lf\n", ans);
  return 0;
}
