{$M 100000000}
Var     n,m,r,t,mm,i,j,o,ans,cnt,x,y:longint;
  p:array[0..101]of longint;
  ok:boolean;
  pp,b:array[0..101*101]of longint;
  a:array[0..101,0..101]of boolean;
 function min(x,y:longint):longint; begin if x>y then min:=y else min:=x;end;
 function dfs(v:longint):boolean;
   var j,vv:longint;
     begin
      // if b[v]=o then exit(false);
       b[v]:=o;
       vv:=v mod n;
       if vv=0 then vv:=n;
       for j:=1 to m do
         if (a[vv,j])and(p[j]=0) then
           begin
             p[j]:=v;
             ok:=true;
             pp[v]:=j;
             dfs:=true;
             exit;
           end;
       for j:=1 to m do
         if (a[vv,j])and(b[p[j]]<>o) then if dfs(p[j]) then
           begin
            p[j]:=v;
            pp[v]:=j;
            ok:=true;
            dfs:=true;
            exit;
           end;
       dfs:=false;
     end;
  begin
    assign(input,'contest.in');
    reset(input);
    assign(output,'contest.out');
    rewrite(output);
    read(n,m,t,r);
    for x:=1 to n do
      begin
        read(o);
        while o>0 do
          begin
            read(y);
            a[x,y]:=true;
            dec(o);
          end;
      end;
      o:=0;
    for i:=1 to min(t div r,m) do
      begin
        ok:=false;
        for j:=1 to n do
         if pp[(i-1)*n+j]=0 then
         begin
          o:=o+1;
          dfs((i-1)*n+j);
         end;
        if not ok then break;
      end;
    x:=0;
    y:=0;
    for i:=1 to m do
      if p[i]<>0 then
        begin
          x:=x+1;
          y:=y+((p[i]-1)div n+1)*r;
        end;
    Writeln(x,' ',y);
{    for i:=1 to n*m do
       if pp[i]<>0 then
         begin
           Writeln(i mod n+n*ord(i mod n=0),' ',pp[i],' ',((i-1)div n)*r);
         end;
 }   close(input);
    close(output);
  end.
