#include <bits/stdc++.h>
using namespace std;
int n;
double mat[18][18];
double memo[18][1 << 18];
double dp(int cur, int msk) {
  int cnt = __builtin_popcount(msk);
  if (cnt == n - 1) {
    return mat[0][cur];
  }
  double &ret = memo[cur][msk];
  if (ret == ret) {
    return ret;
  }
  ret = 0;
  for (int i = 1; i < n; ++i) {
    if ((msk & (1 << i)) == 0) {
      ret = max(ret, dp(cur, msk | (1 << i)) * mat[cur][i] +
                         dp(i, msk | (1 << i)) * mat[i][cur]);
    }
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      cin >> mat[i][j];
    }
  }
  if (n == 1) {
    cout << 1.0 << '\n';
  } else {
    memset(memo, -1, sizeof memo);
    double ans = 0;
    for (int i = 1; i < n; ++i) {
      ans = max(ans, dp(i, 1 << i));
    }
    cout << fixed << setprecision(9) << ans << '\n';
  }
  return 0;
}
