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