#include <bits/stdc++.h>
using namespace std;
int Got[1005], Tot[1005];
long double f[1005][1005];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  vector<pair<int, int> > g;
  g.reserve(1005);
  for (int i = 0; i < m; i++) {
    scanf("%d", &Tot[i]);
    for (int j = 0; j < Tot[i]; j++) {
      int c;
      scanf("%d", &c);
      g.push_back(make_pair(c, i));
    }
  }
  int t = g.size();
  sort(g.begin(), g.end(), greater<pair<int, int> >());
  int d = g[n - 1].first, i;
  long double p = 1;
  for (i = 0; g[i].first != d; i++) {
    int name = g[i].second;
    p *= (Got[name] + 1.) / (Tot[name] - Got[name]);
    Got[name]++;
  }
  vector<int> id;
  id.reserve(1005);
  int l = n - i;
  for (; i < t && g[i].first == d; i++) {
    id.push_back(g[i].second);
  }
  int s = id.size();
  long double Q[1005];
  for (int i = 0; i < s; i++) {
    Q[i] = (Got[id[i]] + 1.) / (Tot[id[i]] - Got[id[i]]);
  }
  f[0][0] = p;
  for (int y = 0; y < s; y++) {
    for (int x = 0; x <= y; x++) {
      f[x + 1][y + 1] += f[x][y] * Q[y] * (x + 1.) / (y + 1.);
      f[x][y + 1] += f[x][y] * (y - x + 1.) / (y + 1.);
    }
  }
  cout << fixed << setprecision(9) << f[l][s] << endl;
}
