#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10;
int n, h, m, k;
vector<int> v;
int L[MAXN], R[MAXN];
int num[MAXN];
map<int, int> Mp;
int ans[MAXN], tot = 0;
int S[MAXN];
void add(int B, int E) {
  S[B]++;
  S[E + 1]--;
}
int main() {
  scanf("%d%d%d%d", &n, &h, &m, &k);
  m /= 2;
  if (k == 1) {
    cout << 0 << " " << 0 << endl;
    cout << endl;
    return 0;
  }
  for (int i = 1; i <= n; ++i) {
    int hi, mi;
    scanf("%d%d", &hi, &mi);
    if (k != 1) R[i] = (mi + m + k - 1) % m, L[i] = (mi + m + 1) % m;
    v.push_back(L[i]);
    if (L[i] > 0) v.push_back(L[i] - 1);
    v.push_back(R[i]);
    if (R[i] < m - 1) v.push_back(R[i] + 1);
  }
  v.push_back(0);
  v.push_back(m - 1);
  sort(v.begin(), v.end());
  int cnt = 0;
  for (int i = 0; i < (int)v.size(); ++i) {
    int u = v[i];
    map<int, int>::iterator it = Mp.find(u);
    if (it == Mp.end()) {
      Mp[u] = ++cnt;
      num[cnt] = u;
    }
  }
  for (int i = 1; i <= n; ++i) {
    L[i] = Mp[L[i]], R[i] = Mp[R[i]];
    if (L[i] > R[i]) {
      add(L[i], cnt);
      add(1, R[i]);
    } else
      add(L[i], R[i]);
  }
  for (int i = 1; i <= cnt; ++i) S[i] += S[i - 1];
  int who = 1;
  for (int i = 2; i <= cnt; ++i)
    if (S[i] < S[who]) who = i;
  for (int i = 1; i <= n; ++i) {
    if (L[i] > R[i]) {
      if (who >= L[i] || who <= R[i]) ans[++tot] = i;
    } else {
      if (who >= L[i] && who <= R[i]) ans[++tot] = i;
    }
  }
  cout << tot << " " << num[who] << endl;
  for (int i = 1; i < tot; ++i) cout << ans[i] << " ";
  if (tot > 0) cout << ans[tot];
  cout << endl;
  return 0;
}
