#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wmissing-declarations"
inline int safe_mul(int x, int y) __attribute__((warn_unused_result));
int const maxn = 20;
double d[1 << maxn][maxn];
double a[maxn][maxn];
int n;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) cin >> a[i][j];
  int l = 1 << n;
  d[1][0] = 1.0;
  for (int mask = 2; mask < l; ++mask) {
    for (int i = 0; i < n; ++i)
      if (mask & (1 << i)) {
        for (int j = 0; j < n; ++j)
          if (j != i && (1 << j) & mask) {
            d[mask][i] = max(d[mask][i], d[mask ^ (1 << j)][i] * a[i][j] +
                                             d[mask ^ (1 << i)][j] * a[j][i]);
          }
      }
  }
  double best = 0.0;
  for (int i = 0; i < n; ++i) best = max(best, d[l - 1][i]);
  cout << fixed << setprecision(10) << best << endl;
}
