#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int MAXN = 20;
double a[MAXN][MAXN];
double dp[MAXN][(1 << MAXN) + 5];
int main() {
  int n, cnt[1 << MAXN] = {};
  for (int i = 1; i < 1 << n; i++) cnt[i] = cnt[i & (i - 1)] + 1;
  cin >> n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> a[i][j];
  int lim = (1 << n) - 1;
  dp[1][1] = 1.0;
  for (int mask = 1; mask <= lim; mask++) {
    if (cnt[mask] == 1) continue;
    for (int i = 1; i <= n; i++) {
      int check1 = i - 1;
      if (mask >> check1 & 1) {
        for (int k = 1; k <= n; k++) {
          int check2 = k - 1;
          if (i != k && ((mask >> check2) & 1)) {
            dp[i][mask] =
                max(dp[i][mask], a[i][k] * dp[i][mask ^ (1 << check2)] +
                                     a[k][i] * dp[k][mask ^ (1 << check1)]);
          }
        }
      }
    }
  }
  double ansa = 0.0;
  for (int j = 1; j <= n; j++) ansa = max(ansa, dp[j][lim]);
  printf("%0.10lf\n", ansa);
  return 0;
}
