ll L,M,Q;bitset<2d5>A,B;{rd(L,M,Q);((1..L+M)>L?B:A)[rd(Q),Q]=1;rd(Q);wt(L=(A&B<<(0..Q-1)).count());}