#include <bits/stdc++.h>
using namespace std;
const long long INF = 1ll << 60;
const long long mod = 1000000007;
const long double PI = acosl(-1);
long long binpow(long long a, long long b) {
  if (b == 0) return 1;
  long long res = binpow(a, b / 2);
  if (b % 2)
    return res * res * a;
  else
    return res * res;
}
long long n;
double nd;
vector<vector<double>> dp, mat;
double rec(long long sta, long long play) {
  if (sta == (1 << n) - 1) {
    if (play == 0) return 1.0;
    return 0;
  }
  if (sta & 1 and play != 0) return 0;
  if (dp[sta][play] > -1) return dp[sta][play];
  double qt = nd - __builtin_popcountll(sta), aux = 0;
  for (int i = 0; i < n; i++) {
    if (((sta >> i) & 1) == 0) {
      aux = max(aux, mat[play][i] * rec(sta + (1 << i), play) +
                         mat[i][play] * rec(sta + (1 << i), i));
    }
  }
  return dp[sta][play] = aux;
}
void solve() {
  long long i, j;
  cin >> n;
  dp.resize(1 << n, vector<double>(n, -1));
  mat.resize(n, vector<double>(n));
  double resp = 0;
  if (n == 1) {
    cout << fixed << setprecision(10) << 1 << "\n";
    return;
  }
  nd = n;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      cin >> mat[i][j];
    }
  }
  for (i = 0; i < n; i++) {
    resp = max(resp, rec((1 << i), i));
  }
  cout << fixed << setprecision(10) << resp << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
}
