#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<double> > p(n, vector<double>(n));
  for (int i = (0); i < int(n); ++i)
    for (int j = (0); j < int(n); ++j) cin >> p[i][j];
  int t = 1 << n;
  vector<vector<double> > dp(n, vector<double>(t, -1));
  function<double(int, int)> calc = [&](int w, int m) {
    if (dp[w][m] == -1) {
      if (!(m & 1)) return dp[w][m] = 0;
      if (m == 1) return dp[w][m] = 1;
      for (int i = (0); i < int(n); ++i)
        if (i != w && ((m >> i) & 1)) {
          double pr = p[w][i];
          dp[w][m] = max(dp[w][m], calc(w, m ^ (1 << i)) * pr +
                                       (1 - pr) * calc(i, m ^ (1 << w)));
        }
    }
    return dp[w][m];
  };
  double ans = 0;
  for (int i = (0); i < int(n); ++i) ans = max(ans, calc(i, t - 1));
  cout.precision(10);
  fixed(cout);
  cout << ans << endl;
}
