#include <bits/stdc++.h>
using namespace std;
double max(double a, double b) { return (a > b ? a : b); }
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  double A[n][n];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      cin >> A[i][j];
    }
  }
  vector<vector<double> > DP(n, vector<double>(1 << n, 0));
  DP[0][0] = 1;
  for (int i = 1; i < n; ++i) {
    DP[i][1 << (n - 1)] = A[0][i];
  }
  double mom = 0;
  for (int k = 1; k < n; ++k) {
    for (int i = 0; i < (1 << n); ++i) {
      if (__builtin_popcount(i) != k) {
        continue;
      }
      for (int player = 0; player < n; ++player) {
        if (i & (1 << player)) {
          continue;
        }
        double mx = 0;
        DP[player][i] = 0;
        for (int enemy = 0; enemy < n; ++enemy) {
          mx = 0;
          if (i & (1 << enemy)) {
            mx += A[player][enemy] * DP[player][i - (1 << enemy)];
            mx += A[enemy][player] * DP[enemy][i - (1 << enemy)];
          }
          DP[player][i] = max(mx, DP[player][i]);
        }
        if (k == n - 1) {
          mom = max(DP[player][i], mom);
        }
      }
    }
  }
  cout << (n == 1 ? 1 : mom) << "\n";
}
