#include <bits/stdc++.h>
using namespace std;
const int maxn = 18;
double p[maxn][maxn];
double dp[1 << maxn][maxn];
bool used[1 << maxn][maxn];
int n;
double f(int mask, int v) {
  if (mask == 1) return p[0][v];
  if (used[mask][v]) return dp[mask][v];
  used[mask][v] = true;
  double ans = 0;
  for (int i = 1; i < n; i++) {
    if (mask & (1 << i)) {
      ans = max(ans, f(mask ^ (1 << i), i) * p[i][v] +
                         f(mask ^ (1 << i), v) * p[v][i]);
    }
  }
  return dp[mask][v] = ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) cin >> p[i][j];
  cout.precision(9);
  cout << fixed;
  if (n == 1)
    cout << 1;
  else if (n == 2)
    cout << p[0][1];
  else {
    double ans = 0;
    int full = (1 << n) - 1;
    for (int i = 1; i < n; i++) ans = max(ans, f(full ^ (1 << i), i));
    cout << ans;
  }
  return 0;
}
