#include <bits/stdc++.h>
using namespace std;
const int MAXN = 18;
int cases;
double p[MAXN][MAXN];
double dp[MAXN][(1 << MAXN) + 1];
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]);
    }
  }
  dp[0][1] = 1;
  for (int o = 3; o < (1 << 18); o += 2) {
    for (int i = 0; i < n; i++) {
      if (o & (1 << i)) {
        for (int j = 0; j < n; j++) {
          if (j != i && o & (1 << j)) {
            dp[i][o] = max(dp[i][o], p[i][j] * dp[i][o ^ (1 << j)] +
                                         p[j][i] * dp[j][o ^ (1 << i)]);
          }
        }
      }
    }
  }
  double ans = 0;
  for (int i = 0; i < n; i++) {
    ans = max(ans, dp[i][(1 << n) - 1]);
  }
  printf("%.8f\n", ans);
}
