#include <bits/stdc++.h>
using namespace std;
const long long N = 19;
long long n, vis[N][(1ll) << N];
long double p[N][N], dp[N][(1ll) << N];
long double func(long long idx, long long mask) {
  if (__builtin_popcount(mask) == n) return 1;
  if (vis[idx][mask]) return dp[idx][mask];
  long double &ans = dp[idx][mask];
  vis[idx][mask] = 1;
  ans = 0;
  for (long long i = 1; i <= n; i++) {
    if (mask & (1ll << i)) continue;
    if (idx == 1)
      ans = max(ans, p[idx][i] * func(idx, mask | (1ll << i)));
    else if (i == 1)
      ans = max(ans, p[i][idx] * func(i, mask | (1ll << i)));
    else
      ans = max(ans, p[idx][i] * func(idx, mask | (1ll << i)) +
                         p[i][idx] * func(i, mask | (1ll << i)));
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= n; j++) cin >> p[i][j];
  long double ans = 0;
  for (long long i = 1; i <= n; i++) ans = max(ans, func(i, (1ll << i)));
  cout << fixed << setprecision(18) << ans;
}
