#include <bits/stdc++.h>
using namespace std;
int n, zh[30];
double mp[30][30], dp[300000][30], ans = 0;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) scanf("%lf", &mp[i][j]);
  zh[0] = 1;
  for (int i = 1; i <= 18; i++) zh[i] = zh[i - 1] * 2;
  dp[1][1] = 1;
  for (int k = 1; k <= zh[n] - 1; k++) {
    for (int i = 1; i <= n; i++)
      if (((1 << (i - 1)) & k) != 0)
        for (int j = 1; j <= n; j++)
          if (((1 << (j - 1)) & k) != 0)
            dp[k][i] = max(dp[k][i], dp[k - (1 << (j - 1))][i] * mp[i][j] +
                                         dp[k - (1 << (i - 1))][j] * mp[j][i]);
  }
  for (int i = 1; i <= n; i++) ans = max(ans, dp[zh[n] - 1][i]);
  printf("%.7lf", ans);
}
