#include <bits/stdc++.h>
using namespace std;
double c[1005][1005];
int b[1005];
double dt[1005][1005];
double dr[1005][1005];
long long dp[1005][1005];
long long dn[1005][1005];
double ds[1005][1005];
int d[1005];
int cmp(int x, int y) { return x > y; }
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  int i;
  c[0][0] = 1.00000000000;
  for (i = 1; i <= 1001; i++) {
    int j;
    c[i][0] = 1.000000000;
    for (j = 1; j <= i - 1; j++) {
      c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
    }
    c[i][i] = 1.000000000;
  }
  memset(dt, 0, sizeof(dt));
  for (i = 0; i <= m; i++) {
    int j;
    for (j = 0; j <= n; j++) dp[i][j] = -(1LL << 50);
  }
  memset(dr, 0, sizeof(dr));
  dt[0][0] = 1;
  dp[0][0] = 0;
  dr[0][0] = 1;
  for (i = 1; i <= m; i++) {
    scanf("%d", &b[i]);
    int j;
    for (j = 1; j <= b[i]; j++) {
      scanf("%d", &d[j]);
    }
    sort(d + 1, d + b[i] + 1, cmp);
    j = 0;
    dn[i][0] = 0;
    ds[i][0] = 1;
    for (j = 1; j <= b[i]; j++) {
      dn[i][j] = dn[i][j - 1] + d[j];
      int rt = -1;
      int k;
      for (k = j; k >= 1 && d[j] == d[k]; k--)
        ;
      rt += j - k;
      int er = j - k;
      for (k = j; k <= b[i] && d[j] == d[k]; k++)
        ;
      rt += k - j;
      ds[i][j] = c[rt][er];
    }
    for (j = 0; j <= b[i]; j++) {
      int k;
      for (k = 0; k <= n - j; k++) {
        if (dp[i][k + j] < dp[i - 1][k] + dn[i][j]) {
          dp[i][k + j] = dp[i - 1][k] + dn[i][j];
          dt[i][k + j] = dt[i - 1][k];
          dr[i][k + j] = dr[i - 1][k] * (ds[i][j] / c[b[i]][j]);
        } else if (dp[i][k + j] == dp[i - 1][k] + dn[i][j]) {
          double p1 = dr[i - 1][k] * (ds[i][j] / c[b[i]][j]);
          double num = dt[i - 1][k];
          dr[i][k + j] =
              (dr[i][k + j] * dt[i][k + j] + p1 * num) / (num + dt[i][k + j]);
          dt[i][k + j] = num + dt[i][k + j];
        }
      }
    }
  }
  printf("%.13f\n", dr[m][n]);
}
