#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;
PII best(0, 0);
int LIM;
struct Node {
  Node *lt, *rt;
  int val;
  Node() {
    lt = rt = NULL;
    val = 0;
  }
  void add(int l, int r, int x, int y) {
    if (l >= y || r <= x) return;
    if (l <= x && y <= r) {
      val++;
      return;
    }
    int z = (y - x) / 2 + x;
    if (!lt) lt = new Node;
    lt->add(l, r, x, z);
    if (!rt) rt = new Node;
    rt->add(l, r, z, y);
  }
  void search(int l, int r, int tot = 0) {
    tot += val;
    if (l < LIM) {
      best = max(best, {tot, l});
    }
    if (r - l <= 1) return;
    int m = (r - l) / 2 + l;
    if (lt) {
      lt->search(l, m, tot);
    }
    if (rt) {
      rt->search(m, r, tot);
    }
  }
};
vector<PII> get(int st, int k, int m) {
  vector<PII> res;
  int l1 = (st + k) % m;
  int r1 = (st + m / 2) % m;
  if (l1 <= r1) {
    res.emplace_back(l1, r1);
  } else {
    res.emplace_back(l1, m - 1);
    res.emplace_back(0, r1);
  }
  int l2 = (st + k + m / 2) % m;
  int r2 = st;
  if (l2 <= r2) {
    res.emplace_back(l2, r2);
  } else {
    res.emplace_back(l2, m - 1);
    res.emplace_back(0, r2);
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  const int LO = 0, HI = 1 << 30;
  Node *root = new Node;
  int n, h, m, k;
  cin >> n >> h >> m >> k;
  LIM = m / 2;
  VI ms;
  for (int i = 0; i < n; i++) {
    int hi, mi;
    cin >> hi >> mi;
    auto v = get(mi, k, m);
    for (auto [l, r] : v) {
      root->add(l, r + 1, LO, HI);
    }
    ms.push_back(mi);
  }
  root->search(LO, HI);
  cout << (n - best.first) << ' ' << best.second << '\n';
  int t = best.second;
  VI rem;
  for (int i = 0; i < n; i++) {
    auto v = get(ms[i], k, m);
    bool ok = false;
    for (auto [l, r] : v) {
      if (l <= t && t <= r) {
        ok = true;
      }
    }
    if (!ok) rem.push_back(i);
  }
  assert((int)rem.size() == n - best.first);
  for (int i : rem) {
    cout << (i + 1) << ' ';
  }
  cout << '\n';
  return 0;
}
