#include <bits/stdc++.h>
using namespace std;
enum Type { Exit, Enter };
struct Event {
  long long time;
  Type type;
  int train;
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  long long h, m, k;
  cin >> n >> h >> m >> k;
  long long interval = m / 2;
  long long commuteCount = h * 2;
  int removedCount = 0;
  vector<bool> removed(n);
  vector<long long> ts;
  vector<Event> events;
  for (int i = 0; i < n; i++) {
    long long hi, mi;
    cin >> hi >> mi;
    long long ti = hi * m + mi;
    ts.push_back(ti);
    Event ein = {ti % interval, Enter, i};
    Event eout = {(ti + k) % interval, Exit, i};
    if (eout.time <= ein.time) {
      removedCount++;
      removed[i] = true;
    }
    events.push_back(ein);
    events.push_back(eout);
  }
  sort(events.begin(), events.end(), [](const Event& a, const Event& b) {
    if (a.time != b.time) return a.time < b.time;
    if (a.type != b.type) return a.type < b.type;
    return a.train < b.train;
  });
  auto process = [&](int target) {
    int best = removedCount;
    long long bestTime = 0;
    for (auto [time, type, train] : events) {
      if (type == Enter) {
        removedCount++;
        removed[train] = true;
      } else {
        removedCount--;
        removed[train] = false;
        if (removedCount < best) {
          best = removedCount;
          bestTime = time;
        }
        if (removedCount == target) {
          return make_pair(removedCount, time);
        }
      }
    }
    return make_pair(best, bestTime);
  };
  auto [haveToRemove, _1] = process(-200300);
  auto [_2, bestTime] = process(haveToRemove);
  cout << haveToRemove << ' ' << bestTime << endl;
  for (int i = 0; i < n; i++)
    if (removed[i]) cout << i + 1 << ' ';
  cout << endl;
  return 0;
}
