#include <bits/stdc++.h>
static constexpr int MAXN = 18;
static double probs[MAXN][MAXN];
static double DP[1 << MAXN][MAXN];
static double prob_start(int size, int guy, int msk) {
  if ((__builtin_popcount(msk)) == 1) return (double)(guy == 0);
  double& ref = DP[msk][guy];
  if (ref < 0) {
    ref = 0.0;
    for (int i = 0; i < size; i++) {
      if (i == guy) continue;
      if (msk & (1 << i)) {
        double prob = 0.0;
        prob += probs[guy][i] * prob_start(size, guy, msk & ~(1 << i));
        prob += probs[i][guy] * prob_start(size, i, msk & ~(1 << guy));
        ref = std::max(ref, prob);
      }
    }
  }
  return ref;
}
int main() {
  int size;
  std::cin >> size;
  if (size == 1) {
    std::cout << "1.0" << std::endl;
    return EXIT_SUCCESS;
  }
  for (int i = 0; i < size; i++)
    for (int j = 0; j < size; j++) std::cin >> probs[i][j];
  for (int i = 0; i < (1 << size); i++)
    for (int j = 0; j < size; j++) DP[i][j] = -1.0;
  double answer = 0.0;
  int total = (1 << size) - 1;
  for (int i = 0; i < size; i++) {
    for (int j = i + 1; j < size; j++) {
      double prob = probs[i][j] * prob_start(size, i, total & ~(1 << j));
      prob += probs[j][i] * prob_start(size, j, total & ~(1 << i));
      answer = std::max(answer, prob);
    }
  }
  std::cout << std::fixed << std::setprecision(17) << answer << std::endl;
  return EXIT_SUCCESS;
}
