#include <bits/stdc++.h>
using namespace std;
long double ANS[100][100];
long double prob[100][100];
long double ar[100][100];
int main() {
  int t1, t2, t3, t4;
  int i, j, k, l, n, m, tot, temp, siz, flag, curr, now;
  char ch;
  long double ans, val;
  cin >> m;
  n = 1 << m;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      cin >> ar[i][j];
    }
  }
  for (i = 0; i < n; i++) {
    if (i % 2)
      ANS[0][i] = ar[i][i - 1] / 100.0;
    else
      ANS[0][i] = ar[i][i + 1] / 100.0;
    prob[0][i] = ANS[0][i];
  }
  for (i = 1; i < m; i++) {
    for (j = 0; j < n; j++) {
      temp = (1 << i);
      k = j / temp;
      if (k % 2) {
        now = k * temp;
        now -= temp;
        for (l = 0; l < temp; l++) {
          curr = now + l;
          prob[i][j] += (ar[j][curr] / 100.0) * prob[i - 1][curr];
        }
        prob[i][j] *= prob[i - 1][j];
        val = 0;
        for (l = 0; l < temp; l++) {
          curr = now + l;
          ANS[i][j] += (ar[j][curr] / 100.0) * prob[i - 1][curr];
          val = max(val, ANS[i - 1][curr]);
        }
        ANS[i][j] *= temp;
        ANS[i][j] *= prob[i - 1][j];
        ANS[i][j] += ANS[i - 1][j];
        ANS[i][j] += val;
      } else {
        now = k * temp;
        now += temp;
        for (l = 0; l < temp; l++) {
          curr = now + l;
          prob[i][j] += (ar[j][curr] / 100.0) * prob[i - 1][curr];
        }
        prob[i][j] *= prob[i - 1][j];
        val = 0;
        for (l = 0; l < temp; l++) {
          curr = now + l;
          ANS[i][j] += (ar[j][curr] / 100.0) * prob[i - 1][curr];
          val = max(val, ANS[i - 1][curr]);
        }
        ANS[i][j] *= temp;
        ANS[i][j] *= prob[i - 1][j];
        ANS[i][j] += ANS[i - 1][j];
        ANS[i][j] += val;
      }
    }
  }
  ans = -100;
  for (i = 0; i < n; i++) ans = max(ans, ANS[m - 1][i]);
  cout << fixed << setprecision(15) << ans << endl;
}
