#include <bits/stdc++.h>
using namespace std;
double dpp[20][2 + (1 << 18)], arr[20][20];
bool vis[20][2 + (1 << 18)];
int n;
double call(int win, int mask) {
  if (mask == 0) {
    if (win == 0) return 1;
    return 0;
  }
  if (vis[win][mask] == 1) return dpp[win][mask];
  vis[win][mask] = 1;
  double ans = 0;
  for (int i = 0; i < n; i++) {
    if ((mask & (1 << i)) != 0) {
      int mask1 = mask ^ (1 << i);
      double tmp =
          call(win, mask1) * arr[win][i] + call(i, mask1) * arr[i][win];
      ans = max(ans, tmp);
    }
  }
  return dpp[win][mask] = ans;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) cin >> arr[i][j];
  }
  memset(vis, 0, sizeof vis);
  double ans = 0;
  for (int i = 0; i < n; i++) {
    int mask = (1 << n) - 1;
    mask ^= 1 << i;
    ans = max(ans, call(i, mask));
  }
  cout << setprecision(10) << fixed;
  cout << ans << "\n";
  return 0;
}
