#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
const int MAX = 1 << 18;
const int N = 18;
double dp[MAX][N];
double g[N][N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  if (n == 1) {
    cout << "1\n";
    return 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> g[i][j];
    }
  }
  double res = 0;
  for (int i = 1; i < (1 << (n - 1)); i++) {
    int pot = 1;
    for (int j = 1; pot <= i; j++) {
      int pot2 = 1;
      if ((pot & i) == pot) {
        if (i == pot) {
          dp[i][j] = g[0][j];
          if (i + 1 == 1 << (n - 1)) res = max(res, dp[i][j]);
          pot *= 2;
          continue;
        }
        for (int k = 1; pot2 <= i; k++) {
          if (((pot2 & i) == pot2) && k != j)
            dp[i][j] = max(
                dp[i][j], dp[i - pot][k] * g[k][j] + dp[i - pot2][j] * g[j][k]);
          pot2 *= 2;
        }
        if (i + 1 == 1 << (n - 1)) res = max(res, dp[i][j]);
      }
      pot *= 2;
    }
  }
  cout.precision(17);
  cout << res << "\n";
}
