#include <bits/stdc++.h>
using namespace std;
long long n;
double prob[20][20], dp[1 << 19][20];
bool mark[1 << 19][20];
double f(long long mask, long long i) {
  if (__builtin_popcount(mask) == 1) {
    if (mask == 1)
      return 1.0;
    else
      return 0.0;
  }
  if (mark[mask][i]) return dp[mask][i];
  mark[mask][i] = 1;
  for (long long j = (long long)(0); j <= (long long)(n - 1); j++) {
    if (j == i) continue;
    if (mask & (1 << j)) {
      double ans = prob[i][j] * f(mask ^ (1 << j), i) +
                   prob[j][i] * f(mask ^ (1 << i), j);
      dp[mask][i] = max(ans, dp[mask][i]);
    }
  }
  return dp[mask][i];
}
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n;
  for (long long i = (long long)(0); i <= (long long)(n - 1); i++)
    for (long long j = (long long)(0); j <= (long long)(n - 1); j++)
      cin >> prob[i][j];
  double ans = 0.0;
  long long mask = 1 << n;
  mask--;
  for (long long i = (long long)(0); i <= (long long)(n - 1); i++)
    ans = max(ans, f(mask, i));
  cout << fixed << setprecision(15) << ans << endl;
  return 0;
}
