#include <bits/stdc++.h>
using namespace std;
int N;
double P[18][18];
double dpt[1 << 18][18];
double f(int bs, int winner) {
  if (bs == (1 << N) - 1) {
    return winner == 0 ? 1.0 : 0.0;
  }
  if (dpt[bs][winner] != -1.0) return dpt[bs][winner];
  double ans = -1.0;
  for (int i = 0; i < N; ++i)
    if (((1 << i) & bs) == 0) {
      ans = max(ans, f(bs | (1 << i), i) * P[i][winner] +
                         f(bs | (1 << i), winner) * P[winner][i]);
    }
  return dpt[bs][winner] = ans;
}
int main() {
  cin >> N;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      cin >> P[i][j];
    }
  }
  for (int i = 0; i < 1 << 18; ++i) {
    for (int j = 0; j < N; ++j) {
      dpt[i][j] = -1;
    }
  }
  double ans = -1;
  for (int i = 0; i < N; ++i) {
    ans = max(ans, f(1 << i, i));
  }
  cout << fixed << setprecision(20) << ans << endl;
}
