#include <bits/stdc++.h>
using namespace std;
const long long N = 20;
double p[N][N], dp[1 << N][20];
void solve() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) cin >> p[i][j];
  }
  dp[1][0] = 1;
  for (long long i = 2; i < (1 << n); i++) {
    for (long long j = 0; j < n; j++) {
      if (i & (1 << j))
        for (long long k = 0; k < n; k++) {
          if (i & (1 << k) && k != j)
            dp[i][j] = max({dp[i][j], dp[i ^ (1 << j)][k] * p[k][j] +
                                          dp[i ^ (1 << k)][j] * p[j][k]});
        }
    }
  }
  cout << setprecision(10) << fixed
       << *max_element(dp[(1 << n) - 1], dp[(1 << n) - 1] + n) << "\n";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
}
