#include <bits/stdc++.h>
using namespace std;
long double dp[18][(1 << 18)];
long double A[18][18];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> A[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    dp[i][(1 << n) - 1] = !i;
  }
  for (int mask = (1 << n) - 2; mask >= 1; mask--) {
    for (int i = 0; i < n; i++) {
      if (mask & (1 << i)) {
        for (int j = 0; j < n; j++) {
          if (mask & (1 << j)) continue;
          dp[i][mask] = max(dp[i][mask], dp[i][mask + (1 << j)] * A[i][j] +
                                             dp[j][mask + (1 << j)] * A[j][i]);
        }
      }
    }
  }
  long double ans = 0;
  for (int i = 0; i < n; i++) {
    ans = max(ans, dp[i][(1 << i)]);
  }
  cout << ans;
  return 0;
}
