#include <bits/stdc++.h>
using namespace std;
int n;
double a[21][21];
double f[1100000];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) scanf("%lf", &a[i][j]);
  f[1] = 1;
  for (int i = 2; i < (1 << n); i++) {
    for (int j = 0; j < n; j++) {
      if (!((1 << j) & i)) continue;
      for (int k = 0; k < n; k++) {
        if (!((1 << k) & i)) continue;
        if (j == k) continue;
        f[i] = max(f[i], a[k + 1][j + 1] * f[i ^ (1 << j)] +
                             a[j + 1][k + 1] * f[i ^ (1 << k)]);
      }
    }
  }
  printf("%.15lf", f[(1 << n) - 1]);
}
