#include <bits/stdc++.h>
using namespace std;
double dp[20][(1 << 20)];
double p[20][20];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> p[i][j];
    }
  }
  dp[0][1] = 1;
  for (int s = 0; s < (1 << n); s++) {
    for (int i = 0; i < n; i++) {
      if (!(s & (1 << i))) continue;
      for (int j = 0; j < n; j++) {
        if (i == j || !(s & (1 << j))) continue;
        dp[i][s] = max(dp[i][s], dp[i][s ^ (1 << j)] * p[i][j] +
                                     dp[j][s ^ (1 << i)] * p[j][i]);
      }
    }
  }
  double ans = 0;
  for (int i = 0; i < n; i++) {
    ans = max(ans, dp[i][(1 << n) - 1]);
  }
  printf("%.10lf\n", ans);
  return 0;
}
