#include <bits/stdc++.h>
using namespace std;
const int MAXN = 20;
double dp[1 << MAXN][MAXN], p[MAXN][MAXN];
int n;
void input();
void solve();
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  input();
  solve();
  return 0;
}
void input() {
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) cin >> p[i][j];
}
void solve() {
  if (n == 1) {
    cout << 1 << endl;
    return;
  }
  dp[1][0] = 1;
  double ans = 0;
  for (int i = 2; i < 1 << n; i++)
    for (int j = 0; j < n; j++) {
      if (i >> j & 1) {
        int x = i - (1 << j);
        for (int k = 0; k < n; k++)
          if (x >> k & 1)
            dp[i][j] = max(dp[i][j], (dp[x][k] * p[k][j]) +
                                         (dp[i - (1 << k)][j] * p[j][k]));
      }
      if (i == (1 << n) - 1) ans = max(ans, dp[i][j]);
    }
  cout.precision(14);
  cout << fixed << ans << endl;
}
