#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, h, m, k;
  cin >> n >> h >> m >> k;
  vector<pair<int, int>> tr(n), t;
  for (int i = 0; i < n; i++) {
    int hi, mi;
    cin >> hi >> mi;
    tr[i] = {hi, mi};
  }
  if (k == 1) {
    cout << 0 << " " << 0 << "\n"
         << "\n";
    exit(0);
  }
  for (int i = 0; i < n; i++) {
    int x = (tr[i].second + 1) % (m / 2), y = (tr[i].second + k - 1) % (m / 2);
    t.push_back({x, 0});
    t.push_back({y + 1, 1});
    if (x > y) {
      t.push_back({0, 0});
    }
    if (x == 0) {
      t.push_back({m / 2, 0});
    }
  }
  sort(t.begin(), t.end());
  int t_sz = t.size();
  int cnt = 0, mn_cnt = n + 1, T = 0;
  for (int i = 0; i < t_sz; i++) {
    if (!t[i].second)
      cnt++;
    else {
      cnt--;
      if (cnt < mn_cnt) {
        mn_cnt = cnt;
        T = t[i].first;
      }
    }
  }
  vector<int> num;
  T %= (m / 2);
  for (int i = 0; i < n; i++) {
    int x = (tr[i].second + 1) % (m / 2), y = (tr[i].second + k - 1) % (m / 2);
    if (x <= y) {
      if (T >= x && T <= y) num.push_back(i + 1);
    } else {
      if ((T >= 0 && T <= y) || (T >= x && T <= m / 2)) num.push_back(i + 1);
    }
  }
  if (num.size() != mn_cnt)
    cout << "fail"
         << "\n";
  cout << mn_cnt << " " << T << "\n";
  for (int i = 0; i < num.size(); i++) {
    cout << num[i] << " ";
  }
  cout << "\n";
  return 0;
}
