#include <bits/stdc++.h>
using namespace std;
long double dp[1 << 18][18];
bool vis[1 << 18][18];
long double P[18 + 1][18 + 1];
int N;
long double F(int mask, int last) {
  if (mask == (1 << N) - 1) return (long double)!last;
  if (vis[mask][last]) return dp[mask][last];
  vis[mask][last] = 1;
  dp[mask][last] = 0.0;
  for (int i = 0; i < N; ++i)
    if (!((mask >> i) & 1))
      dp[mask][last] =
          max(dp[mask][last], P[i][last] * F(mask | (1 << i), i) +
                                  P[last][i] * F(mask | (1 << i), last));
  return dp[mask][last];
}
int main() {
  int i, j;
  cin >> N;
  for (i = 0; i < N; ++i)
    for (j = 0; j < N; ++j) cin >> P[i][j];
  long double ans = 0;
  for (i = 0; i < N; ++i) ans = max(ans, F((1 << i), i));
  cout.precision(11);
  cout << fixed << ans;
  return 0;
}
