#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long double p[n][n];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) cin >> p[i][j];
  long double dp[(1 << n)][n];
  for (int i = 0; i < (1 << n); i++)
    for (int j = 0; j < n; j++) dp[i][j] = 0;
  dp[1][0] = 1;
  for (int i = 0; i < (1 << n); i++) {
    if (i & 1) {
      for (int j = 0; j < n; j++) {
        for (int k = 0; k < n; k++) {
          if (i & (1 << j) and i & (1 << k)) {
            dp[i][j] = max(dp[i][j], (p[k][j]) * dp[i ^ (1 << j)][k] +
                                         (p[j][k]) * dp[i ^ (1 << k)][j]);
          }
        }
      }
    }
  }
  long double ans = 0;
  for (int i = 0; i < n; i++) {
    ans = max(ans, dp[(1 << n) - 1][i]);
  }
  cout << fixed << setprecision(8) << ans << "\n";
  return 0;
}
