#include <bits/stdc++.h>
using namespace std;
double p[20][20];
long long n;
double dp[20][500005];
double prob(long long a, long long m) {
  if (m + 1 == 1 << n) {
    return (a == 0);
  }
  double &ans = dp[a][m];
  if (ans != -1) return ans;
  for (long long i = 0; i < n; i++) {
    if (m & (1 << i)) continue;
    ans = max(
        ans, p[a][i] * prob(a, m ^ (1 << i)) + p[i][a] * prob(i, m ^ (1 << i)));
  }
  return ans;
}
void solve() {
  cout << setprecision(9);
  cout << fixed;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      cin >> p[i][j];
    }
  }
  for (long long i = 0; i < 18; i++) {
    for (long long j = 0; j < 1 << 19; j++) dp[i][j] = -1;
  }
  double ans = 0;
  for (long long i = 0; i < n; i++) {
    ans = max(ans, prob(i, (1 << i)));
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  long long t = 1;
  while (t--) solve();
  return 0;
}
