#include <bits/stdc++.h>
using namespace std;
double pd[1 << 18][18];
int vis[1 << 18][18];
double p[18][18];
double solve(int mask, int cur) {
  if (__builtin_popcount(mask) == 1) {
    if (cur == 0)
      return 1.0;
    else
      return 0.0;
  }
  if (vis[mask][cur]) return pd[mask][cur];
  double& ret = pd[mask][cur];
  vis[mask][cur] = 1;
  ret = 0.0;
  int m = mask;
  while (m) {
    int idx = __builtin_ctz(m);
    m -= m & -m;
    if (idx != cur) {
      ret = max(ret, p[cur][idx] * solve(mask ^ (1 << idx), cur) +
                         p[idx][cur] * solve(mask ^ (1 << cur), idx));
    }
  }
  return ret;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      scanf("%lf", &p[i][j]);
    }
  }
  double ans = 0.0;
  for (int i = 0; i < n; i++) ans = max(ans, solve((1 << n) - 1, i));
  printf("%.10lf\n", ans);
  return 0;
}
