#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const double E = 1e-12;
const double PI = acos(-1);
mt19937_64 rnd(time(0));
long long p1 = 31, p2 = 37, p3 = 7, p4 = rnd() % 100 + 1, md1 = MOD,
          md2 = 998244353, md3 = 998244357, md4 = rnd() % 1000000000;
long long n, m, k, pr[200001];
pair<long long, long long> a[200001];
long long binpow(long long h, long long r, long long md = MOD) {
  long long l = 1;
  while (r) {
    if (r & 1) l *= h, l %= md;
    h *= h;
    h %= md;
    r /= 2;
  }
  return l;
}
long long gcd(long long x, long long y) {
  if (x < y) swap(x, y);
  while (x && y) {
    x %= y;
    swap(x, y);
  }
  return x + y;
}
void solve() {
  long long h;
  cin >> n >> h >> m >> k;
  vector<pair<long long, long long> > v;
  vector<long long> vv;
  for (int i = 1; i <= n; i++) {
    long long x, y;
    cin >> x >> y;
    y += x * m;
    long long o1 = y % (m / 2), o2 = (o1 + k) % (m / 2);
    if (o1 < o2) {
      v.push_back(make_pair(o1 + 1, -1));
      v.push_back(make_pair(o2, 1));
    } else {
      v.push_back(make_pair(0, -1));
      v.push_back(make_pair(o2, 1));
      v.push_back(make_pair(o1 + 1, -1));
    }
    vv.push_back(y);
  }
  sort(v.begin(), v.end());
  long long ans = 0, mx = 0, nw = n;
  if (v.size() == 0 || v[0].first > 0) mx = n, ans = 0;
  for (int i = 0; i < v.size(); i++) {
    nw += v[i].second;
    if (i + 1 < v.size() && v[i + 1].first == v[i].first) continue;
    if (mx < nw) mx = nw, ans = v[i].first;
  }
  cout << n - mx << " " << ans << "\n";
  for (int i = 0; i < n; i++) {
    long long y = vv[i];
    long long o = y % (m / 2);
    long long o1 = ans - k, o2 = ans;
    if (o1 < 0) o1 += m / 2;
    o1 %= (m / 2);
    if (o1 < o2) {
      if (o1 < o && o < o2) cout << i + 1 << " ";
    } else {
      if (o < o2 || o > o1) cout << i + 1 << " ";
    }
  }
  cout << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
