#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")
const int N = (int)20 + 7, inf = (int)1e9 + 7, mod = (int)1e9 + 7;
const long long linf = (long long)1e18 + 7;
const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1},
          dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
using namespace std;
int n;
double a[N][N];
double dp[1 << 18][18];
bool was[1 << 18][18];
double calc(int mask, int last) {
  if (__builtin_popcount(mask) == n) {
    return !last;
  }
  if (!was[mask][last]) {
    double res = 0;
    for (int i = 0; i < n; i++) {
      if (mask & (1 << i)) continue;
      int nxtMask = mask | (1 << i);
      res = max(res, calc(nxtMask, last) * a[last][i] +
                         calc(nxtMask, i) * a[i][last]);
    }
    was[mask][last] = 1;
    dp[mask][last] = res;
  }
  return dp[mask][last];
}
int main() {
  ios_base ::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  double ans = 0;
  for (int i = 0; i < n; i++) {
    ans = max(ans, calc(1 << i, i));
  }
  cout << setprecision(10) << fixed << ans;
  exit(0);
}
