#include <bits/stdc++.h>
using namespace std;
double p[600][600], pp[600][600];
double f[600][600];
bool checkInRound(int I, int K, int Round) {
  int i = I - 1;
  int k = K - 1;
  if (i / (1 << Round) != k / (1 << Round)) return false;
  if (i / (1 << (Round - 1)) == k / (1 << (Round - 1))) return false;
  return true;
}
int main() {
  memset(f, 0, sizeof(f));
  int N;
  cin >> N;
  int SL = 1 << N;
  for (int i = 1; i <= SL; i++) {
    int temp;
    for (int j = 1; j <= SL; j++) {
      scanf("%d", &temp);
      p[i][j] = temp * 0.01;
    }
  }
  int Round = N;
  for (int i = 1; i <= SL; i++) {
    if (i % 2) {
      f[i][1] = p[i][i + 1];
    } else {
      f[i][1] = p[i][i - 1];
    }
  }
  for (int i = 1; i <= SL; i++) pp[i][1] = f[i][1];
  for (int R = 2; R <= Round; R++) {
    for (int i = 1; i <= SL; i++) {
      for (int k = 1; k <= SL; k++) {
        if (checkInRound(i, k, R)) {
          pp[i][R] += pp[i][R - 1] * pp[k][R - 1] * p[i][k];
        }
      }
    }
  }
  for (int R = 2; R <= Round; R++) {
    for (int i = 1; i <= SL; i++) {
      double mem = 0;
      for (int k = 1; k <= SL; k++) {
        if (checkInRound(i, k, R)) {
          f[i][R] += pp[i][R - 1] * pp[k][R - 1] * p[i][k] * (1 << (R - 1));
          mem = max(mem, f[k][R - 1]);
        }
      }
      f[i][R] += mem + f[i][R - 1];
    }
  }
  double ans = 0;
  for (int i = 1; i <= SL; i++) ans = max(ans, f[i][Round]);
  printf("%.12f", ans);
}
