#include <bits/stdc++.h>
using namespace std;
int M;
double P[20][20], dp[19][(1 << 18) + 5];
double solve(int N, int mask) {
  if (mask == (1 << M) - 1) {
    if (N == 0) return 1;
    return 0;
  }
  if (fabs(dp[N][mask] + 1) > 0.1) return dp[N][mask];
  double ans = -1;
  for (int i = 0; i < M; i++) {
    if (((1 << i) & mask) == 0)
      ans = max(ans, P[i][N] * solve(i, mask + (1 << i)) +
                         P[N][i] * solve(N, mask + (1 << i)));
  }
  return dp[N][mask] = ans;
}
int main() {
  int N;
  cin >> N;
  M = N;
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) scanf("%lf", &P[i][j]);
  for (int i = 0; i <= 18; i++)
    for (int j = 0; j < (1 << 18); j++) dp[i][j] = -1;
  double ans = -1;
  for (int i = 0; i < N; i++) ans = max(ans, solve(i, (1 << i)));
  printf("%.9lf\n", ans);
  return 0;
}
