#include <bits/stdc++.h>
using namespace std;
double arr[18][18];
vector<vector<double>> dp;
vector<vector<bool>> done;
long long terminal, n;
double solve(long long mask, long long oponent) {
  if (terminal == (mask | (1 << oponent))) {
    return oponent == 0;
  }
  if (done[mask][oponent]) return dp[mask][oponent];
  double& res = dp[mask][oponent];
  for (long long i = 0; i < n; i++) {
    if ((mask & (1 << i)) == 0 && i != oponent) {
      res = max(res, arr[i][oponent] * solve(mask | (1 << oponent), i) +
                         arr[oponent][i] * solve(mask | (1 << i), oponent));
    }
  }
  done[mask][oponent] = true;
  return res;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  done.resize(1 << n, vector<bool>(n, false));
  dp.resize(1 << n, vector<double>(n, 0));
  terminal = (1 << n) - 1;
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < n; j++) cin >> arr[i][j];
  double res = 0;
  for (long long i = 0; i < n; i++) res = max(res, solve(0, i));
  cout << setprecision(12) << res << "\n";
  return 0;
}
