1 #include<cstdio>
2 #include<cstring>
3 #include<cmath>
4 #include<ctime>
5 #include<cstdlib>
6 #include<iostream>
7 #include<algorithm>
8 #define clr(a,x) memset(a,x,sizeof(a))
9 #define rep(i,l,r) for(int i=l;i<r;i++)
10 #define b(a) (1<<(a))
11 using namespace std;
12 int read()
13 {
14 char c=getchar();
15 int ans=0,f=1;
16 while(!isdigit(c)){
17 if(c==‘-‘) f=-1;
18 c=getchar();
19 }
20 while(isdigit(c)){
21 ans=ans*10+c-‘0‘;
22 c=getchar();
23 }
24 return ans*f;
25 }
26 const int maxn=16,maxk=102;
27 double dp[maxk][b(maxn)];
28 int v[maxn],q[maxn];
29 int main()
30 {
31 clr(dp,0);
32 int k=read(),n=read();
33 rep(i,0,n){
34 v[i]=read();
35 q[i]=0;
36 int t=read();
37 while(t){
38 q[i]|=b(t-1);
39 t=read();
40 }
41 }
42 for(int i=k-1;i>=0;i--){
43 rep(j,0,b(n)){
44 rep(l,0,n){
45 if((j&q[l])==q[l])
46 dp[i][j]+=max(dp[i+1][j|b(l)]+v[l],dp[i+1][j]);
47 else dp[i][j]+=dp[i+1][j];
48 }
49 dp[i][j]/=n;
50 }
51 }
52 printf("%.6lf",dp[0][0]);
53 return 0;
54 }