#include <bits/stdc++.h>
using namespace std;
double dp[1 << 18], p[18][18];
int n;
double f(int mask) {
  if (!(mask & 1)) return 0;
  double &ret = dp[mask];
  if (ret > -0.5) return ret;
  ret = 0;
  for (int i = 1; i < n; i++) {
    if (!(mask & (1 << i))) continue;
    for (int j = 0; j < i; j++) {
      if (!(mask & (1 << j))) continue;
      double cur = 0;
      cur += p[i][j] * f(mask ^ (1 << j));
      cur += p[j][i] * f(mask ^ (1 << i));
      ret = max(ret, cur);
    }
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> p[i][j];
    }
  }
  for (int i = 0; i < (1 << n); i++) dp[i] = -0.5;
  dp[1] = 1;
  int mask = (1 << n) - 1;
  f(mask);
  cout << setprecision(10) << f(mask);
  return 0;
}
