#include <bits/stdc++.h>
using namespace std;
using ld = double;
const ld eps = 1e-11;
const int N = 18;
ld p[N][N], dp[N][(1 << N) + 5];
int n;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  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 mask = 0; mask < (1 << n); mask++)
    for (int j = 0; j < n; j++) {
      if (mask & (1 << j)) {
        for (int k = 0; k < n; k++) {
          if (j != k && (mask & (1 << k))) {
            dp[j][mask] =
                max(dp[j][mask], p[j][k] * dp[j][mask ^ (1 << k)] +
                                     p[k][j] * dp[k][mask ^ (1 << j)]);
          }
        }
      }
    }
  ld ans = 0;
  for (int i = 0; i < n; i++) {
    ans = max(ans, dp[i][(1 << n) - 1]);
  }
  cout << setprecision(17) << fixed << (n == 1 ? 1 : ans) << '\n';
  return 0;
}
