#include <bits/stdc++.h>
using namespace std;
long double a[19][19];
long double dp[19][1 << 18];
bool calc[19][1 << 18];
int n;
long double func(int i, int mask) {
  if (__builtin_popcountll(mask) == 1) {
    for (int j = 1; j <= n; j++) {
      if ((mask >> (j - 1)) & 1) {
        return a[1][j] + a[1][i];
      }
    }
  }
  if (i == 0) {
    long double ans = 0.0000000;
    for (int j = 1; j <= n; j++) {
      for (int k = j + 1; k <= n; k++) {
        mask = mask ^ (1 << (j - 1));
        mask = mask ^ (1 << (k - 1));
        long double temp = 0.00000000;
        temp = a[j][k] * func(j, mask);
        if (j != 1) temp += a[k][j] * func(k, mask);
        ans = max(ans, temp);
        mask = mask ^ (1 << (j - 1));
        mask = mask ^ (1 << (k - 1));
      }
    }
    return ans;
  }
  if (calc[i][mask]) return dp[i][mask];
  long double ans = 0.000000000;
  for (int j = 1; j <= n; j++) {
    if ((mask >> (j - 1)) & 1) {
      mask = mask ^ (1 << (j - 1));
      if (i == 1 or j == 1) {
        if (i == 1)
          ans = max(ans, a[i][j] * func(i, mask));
        else
          ans = max(ans, a[j][i] * func(j, mask));
      } else {
        long double temp = 0.0000000;
        temp = a[i][j] * func(i, mask);
        temp += a[j][i] * func(j, mask);
        ans = max(ans, temp);
      }
      mask = mask ^ (1 << (j - 1));
    }
  }
  calc[i][mask] = true;
  dp[i][mask] = ans;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  int i, j;
  cin >> n;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      cin >> a[i][j];
    }
  }
  if (n == 1) {
    cout << 1.0000000 << endl;
    return 0;
  }
  if (n == 2) {
    cout << fixed << setprecision(15) << a[1][2] << endl;
    return 0;
  }
  int mask = (1 << n) - 1;
  cout << fixed << setprecision(15) << func(0, mask) << endl;
  return 0;
}
