#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  double prob[n][n];
  double dp[100][100];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) cin >> prob[i][j];
  }
  int mask[100];
  int mmm[100];
  mmm[0] = 0;
  dp[0][0] = 1;
  mask[0] = 1;
  for (int k = 1; k < n; k++) {
    mmm[k] = -1;
    for (int i = 0; i < n; i++) {
      if (mask[i] == 0) {
        dp[k][i] = dp[k - 1][mmm[k - 1]] * prob[mmm[k - 1]][i] +
                   dp[k - 1][i] * prob[i][mmm[k - 1]];
        if (mmm[k] == -1 or dp[k][mmm[k]] < dp[k][i]) mmm[k] = i;
      }
    }
    mask[mmm[k]] = 1;
  }
  printf("%.15f", dp[n - 1][mmm[n - 1]]);
  return 0;
}
