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

vector<int> weight, order, used, mt;
vector<vector<int> > g; 

bool cmp(int a, int b)
{
  return weight[a] < weight[b];  
}

bool kuhn(int v)
{
  if(used[v])
    return false;
  used[v] = 1;
  for(int i = 0; i < (int)g[v].size(); i++)
  {
    int u = g[v][i];
    if(mt[u] == -1 || kuhn(mt[u]))
    {
      mt[u] = v;
      return true;
    }
  }
  return false;
}

int main()
{ 
  freopen("contest.in", "r", stdin);
  freopen("contest.out", "w", stdout);
  int n, m, t, l;
  cin >> n >> m >> t >> l;
  if(l > t)
  {
    cout << "0 0" << endl;
    return 0;
  }
  int q = 1;
  while(q * l < t)
    q++;
  g.resize(n * q);
  weight.resize(n * q);
  order.resize(n * q);
  mt.assign(m, -1);
  for(int i = 0; i < n; i++)
  {
    int k;
    cin >> k;
    for(int j = 0; j < k; j++)
    {
      int a;
      cin >> a;
      for(int z = 0; z < q; z++)
        g[q * i + z].push_back(a - 1), weight[q * i + z] =  (z + 1) * l;
    }
  }
  /*for(int i = 0; i < n * q; i++)
  {
    for(int j = 0; j < (int)g[i].size(); j++)
      cout << g[i][j] << ' ';
    cout << endl;
  } */

  for(int i = 0; i < q * n; i++)
    order[i] = i;
  sort(order.begin(), order.end(), cmp);
  /*for(int i = 0; i < q * n; i++)
    cout << order[i] << ' ';
  cout << endl;*/
  for(int i = 0; i < q * n; i++)
  {
    int v = order[i];
    used.assign(q * n, 0);
    kuhn(v);
  }
  int ansn = 0, anst = 0;
  for(int i = 0; i < m; i++)
    if(mt[i] != -1)
      ansn++, anst += (mt[i] % q + 1) * l;//cout << mt[i] / q << ' ' << (mt[i] % q + 1) * l << ' ' << i + 1 << endl;
  cout << ansn << ' ' << anst << endl; 
  return 0;
}
