#include<iostream>
#include<vector>
#include<cstdio>
using namespace std;

vector<int> pCode;

//encode positions
void genCode(int A, int l, int p, int sum){
  if(A-p-l<0)return;
  if(l==0){ pCode.push_back(sum); return; }
  for(int i=p;i<A;i++) genCode(A,l-1,i+1,sum+(1<<i));
}

//distance between positions
int diff(int i, int j){
  int sum1=0, sum2=0, p1=pCode[i], p2=pCode[j];
  while(p1 || p2){ if(p1%2!=p2%2){ sum1+=p1%2; sum2+=p2%2; } p1>>=1; p2>>=1; }
  return sum1>?sum2;
}

int main(){
  while(1){
    //Arrows, Legs, Delay, Time
    int A, L, D, T, M; cin>>A>>L>>D>>T>>M; if(!A)break;
    int ev[T+1]; for(int i=0;i<=T;i++)ev[i]=0;
    pCode.clear();
    genCode(A, L, 0, 0);
    int pc=pCode.size();
    for(int i=0;i<M;i++){
      //time, arrows to press
      int t, k; cin>>t>>k;
      int pos=0;
      for(int j=0;j<k;j++){ int l; cin>>l; pos+=1<<(l-1); }
      ev[t]=pos;
    }
    int game[T+1][pCode.size()];
    for(int i=0;i<pc;i++)game[0][i]=0;
    int dist[pc][pc];
    //precompute distances, we will need them _many_ times
    for(int i=0;i<pc;i++)
      for(int j=0;j<pc;j++)
        dist[i][j]=diff(i, j)/2+D;
    for(int i=1;i<=T;i++){
      for(int j=0;j<pc;j++){
        //standing still didn't hurt anyone yet :)
        int mx=game[i-1][j];
        //if there is an event and we jumped on the right arrows, score
        int score=0; if(ev[i] && ev[i]==(ev[i]&pCode[j]))score=1;
        for(int k=0;k<pc;k++){
          //for every second, for every position, look at every position and get time
          //time is K/2+D, where K is distance between positions, i.e. number of misplaced legs
          int to=i-dist[j][k];
          mx>?=game[to>?0][k]+score*(to>=0);
        }
        game[i][j]=mx;
      }
    }
    int best=0;
    for(int i=0;i<pc;i++)best>?=game[T][i];
    cout<<best<<" move(s)"<<endl;
  }
}
