#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int MAX = 19;
double a[MAX][MAX];
double dp[MAX][1 << MAX];
int memo[MAX][1 << MAX];
int n;
double func(int c, int mask) {
  if (mask + 1 == (1 << n)) {
    if (c == 0) return 1;
    return 0;
  }
  if (memo[c][mask]) return dp[c][mask];
  double ans = 0.0;
  for (int i = 0; i < n; i++) {
    if ((mask & (1 << i)) == 0) {
      ans = max(ans, a[i][c] * func(i, mask | (1 << i)) +
                         a[c][i] * func(c, mask | (1 << i)));
    }
  }
  memo[c][mask] = 1;
  return dp[c][mask] = ans;
}
int main() {
  int i, j, k;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      scanf("%lf", &a[i][j]);
    }
  }
  double ans = 0.0;
  for (i = 0; i < n; i++) {
    ans = max(ans, func(i, 1 << i));
  }
  printf("%.11lf\n", ans);
  return 0;
}
