#include <bits/stdc++.h>
using namespace std;
const int N = 19;
double p[N][N], dp[N][1 << N];
bool vis[N][1 << N];
double f(int idx, int mask) {
  if (__builtin_popcount(mask) == 1) return mask == 1;
  if (vis[idx][mask]) return dp[idx][mask];
  vis[idx][mask] = 1;
  double res = 0;
  for (int i = 0; (1 << i) <= mask; i++) {
    if ((mask >> i) & 1) {
      res = max(res, f(idx, mask ^ (1 << i)) * p[idx][i] +
                         f(i, mask ^ (1 << idx)) * p[i][idx]);
    }
  }
  return dp[idx][mask] = res;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> p[i - 1][j - 1];
    }
  }
  double res = 0;
  for (int i = 0; i < n; i++) {
    res = max(res, f(i, (1 << n) - 1));
  }
  cout << fixed << setprecision(10) << res << endl;
}
