#include //#include using namespace std; //using namespace atcoder; using ll = long long; //using mint = modint998244353; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); int N, X, Q, ans=0; cin >> N >> X >> Q; while(Q--){ int M; cin >> M; set st; bool f=0, g=0; //f:ウミネコが行動したか?g:2回以上行動したものがいるか? while(M--){ ll z; cin >> z; if (z == X) f=1; if (st.count(z)) g=1; st.insert(z); } if (f) ans += 2; else if (g) ans += 1; } cout << setprecision(18) << (long double)ans/2 << endl; return 0; }