#include <bits/stdc++.h>
using namespace std;
int n;
vector<vector<double>> memo, p;
double survival(int mask, int i) {
  if ((mask & 1) && i != 0) {
    return 0;
  }
  if (mask == (1 << n) - 1 && i == 0) {
    return 1;
  }
  if (memo[mask][i] != -1) {
    return memo[mask][i];
  }
  double result = 0;
  for (int j = 0; j < n; j++) {
    if (mask & (1 << j)) continue;
    result = max(result, p[i][j] * survival(mask | (1 << j), i) +
                             p[j][i] * survival(mask | (1 << j), j));
  }
  memo[mask][i] = result;
  return result;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout << setprecision(12);
  cin >> n;
  memo.assign(1 << n, vector<double>(n, -1));
  p.assign(n, vector<double>(n, 0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> p[i][j];
    }
  }
  double result = 0;
  for (int i = 0; i < n; i++) {
    result = max(result, survival(1 << i, i));
  }
  cout << result << endl;
}
