#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, h, m, k;
  cin >> n >> h >> m >> k;
  long long m2 = m / 2, val = 0, bst = 0, mn;
  map<long long, long long> df;
  vector<long long> M;
  for (long long i = 0; i < n; i++) {
    long long hh, mm;
    cin >> hh >> mm;
    M.push_back(mm);
    long long st = (mm - k + m2 + 1) % m2;
    long long fn = mm % m2;
    df[st]++;
    df[fn]--;
    if (st > fn) val++;
  }
  mn = 1005000;
  for (const auto &it : df) {
    val += it.second;
    if (val < mn) {
      mn = val;
      bst = it.first;
    }
  }
  cout << mn << " " << (bst + k) % m2 << "\n";
  bst += m + k;
  for (long long i = 0; i < n; i++) {
    long long mm = M[i] % m2;
    while (mm + m2 < bst) mm += m2;
    if (mm > bst - k) cout << i + 1 << " ";
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long t = 1;
  while (t--) {
    solve();
  }
}
