#include <bits/stdc++.h>
using namespace std;
double p[20][20];
double dp[1 << 20][20];
int n;
int main() {
  while (scanf("%d", &n) == 1) {
    memset(dp, 0, sizeof dp);
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        scanf("%lf", &p[i][j]);
      }
    }
    dp[1][0] = 1;
    for (int st = 2; st <= (1 << n) - 1; st++) {
      for (int i = 0; i < n; i++) {
        if (st & (1 << i)) {
          for (int j = 0; j < n; j++) {
            if (i != j && st & (1 << j)) {
              dp[st][i] = max(dp[st][i], p[i][j] * dp[st ^ (1 << j)][i] +
                                             p[j][i] * dp[st ^ (1 << i)][j]);
            }
          }
        }
      }
    }
    double ans = 0;
    for (int i = 0; i < n; i++) ans = max(ans, dp[(1 << n) - 1][i]);
    printf("%.15f\n", ans);
  }
  return 0;
}
