#include <bits/stdc++.h>
using namespace std;
long double mem[20][(1 << 18) + 5];
long double arr[20][20];
long double n;
long double solve(int curplayer, long long mask) {
  long double ret = 0;
  bool b = 0;
  if (mem[curplayer][mask] != -1) return mem[curplayer][mask];
  for (int i = 0; i < n; i++) {
    if ((mask & (1 << i)) == (1 << i) || i == curplayer) continue;
    if (curplayer == 0 || i == 0)
      ret = max(ret,
                solve(0, (mask | (1 << i))) * arr[0][(i == 0 ? curplayer : i)]);
    else
      ret =
          max(ret, solve(i, (mask | (1 << i))) * arr[i][curplayer] +
                       solve(curplayer, (mask | (1 << i))) * arr[curplayer][i]);
    b = 1;
  }
  if (!b) return mem[curplayer][mask] = 1;
  return mem[curplayer][mask] = ret;
}
int main() {
  for (int i = 0; i < 20; i++)
    for (int j = 0; j < (1 << 18) + 5; j++) mem[i][j] = -1.0;
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) cin >> arr[i][j];
  long double ans = 0;
  for (int i = 0; i < n; i++) ans = max(ans, solve(i, (1 << i)));
  cout << fixed << setprecision(15) << ans;
  return 0;
}
