#include <bits/stdc++.h>
using namespace std;
const int N = 19;
long double dp[N][1 << N];
long double p[N][N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) cin >> p[i][j];
  }
  dp[0][1] = (long double)1;
  for (int mask = 1; mask < (1 << n); mask++) {
    for (int i = 0; i < n; i++) {
      if ((mask & (1 << i))) {
        for (int j = 0; j < n; j++) {
          if ((i != j) && (mask & (1 << j))) {
            dp[i][mask] =
                max(dp[i][mask], dp[j][mask ^ (1 << i)] * p[j][i] +
                                     dp[i][mask ^ (1 << j)] * p[i][j]);
          }
        }
      }
    }
  }
  long double ans = (long double)0;
  for (int i = 0; i < n; i++) {
    ans = max(ans, dp[i][(1 << n) - 1]);
  }
  cout << setprecision(10) << fixed << ans;
  return 0;
}
