#include <bits/stdc++.h>
using namespace std;
map<long long, int> zip;
vector<long long> unzip;
template <typename T>
void compress(vector<T>& v) {
  for (int i = 0; i < (int)v.size(); i++) unzip.push_back(v[i]);
  sort(unzip.begin(), unzip.end());
  unzip.erase(unique(unzip.begin(), unzip.end()), unzip.end());
  for (int i = 0; i < (int)unzip.size(); i++) zip[unzip[i]] = i;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, h, m, k;
  cin >> n >> h >> m >> k;
  m /= 2;
  k--;
  vector<int> all;
  vector<pair<int, int>> a;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    a.emplace_back((y + 1) % m, (y + 1 + k) % m);
    all.push_back(a.back().first);
    all.push_back(a.back().second);
  }
  compress(all);
  for (auto& p : a) {
    p.first = zip[p.first];
    p.second = zip[p.second];
  }
  int nn = unzip.size();
  vector<int> imos(nn);
  for (auto& p : a) {
    if (p.first <= p.second) {
      imos[p.first]++;
      imos[p.second]--;
    } else {
      imos[p.first]++;
      imos[0]++;
      imos[p.second]--;
    }
  }
  for (int i = 1; i < nn; i++) imos[i] += imos[i - 1];
  int cnt = *min_element(imos.begin(), imos.end());
  int pos = min_element(imos.begin(), imos.end()) - imos.begin();
  vector<int> ca;
  for (int i = 0; i < n; i++) {
    auto& p = a[i];
    if (p.first <= p.second) {
      if (p.first <= pos && pos < p.second) ca.push_back(i);
    } else {
      if (pos < p.second || p.first <= pos) ca.push_back(i);
    }
  }
  cout << cnt << " " << unzip[pos] << endl;
  for (int i = 0; i < (int)ca.size(); i++) {
    if (i > 0) cout << " ";
    cout << ca[i] + 1;
  }
  cout << endl;
  return 0;
}
