#include using namespace std; #define int long long const int inf=1e18; signed main(){ ios::sync_with_stdio(false); cin.tie(nullptr); double ans=0; int n,x,q;cin>>n>>x>>q; while(q--){ int m;cin>>m; mapcnt; bool ok=false; while(m--){ int id;cin>>id; cnt[id]++; if(cnt[id]>=2&&id!=x)ok=true; } if(cnt[x]>=1)ans++; else if(ok)ans+=(double)1/2; } cout<