#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 100;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, H, M, K;
  cin >> n >> H >> M >> K;
  if (K == 1) {
    cout << "0 0" << endl;
    return 0;
  }
  vector<pair<int, int>> Ranges;
  vector<int> who;
  for (int i = 1; i <= n; i++) {
    int h, m;
    cin >> h >> m;
    m %= (M / 2);
    int l = m + 1, r = m + K - 1;
    if (l == M / 2) {
      l %= (M / 2);
      r %= (M / 2);
      Ranges.push_back({l, r});
      who.push_back(i);
    } else {
      if (r < M / 2) {
        Ranges.push_back({l, r});
        who.push_back(i);
      } else {
        Ranges.push_back({l, M / 2 - 1});
        Ranges.push_back({0, r % (M / 2)});
        who.push_back(i);
        who.push_back(i);
      }
    }
  }
  set<int> SS;
  SS.insert(0);
  SS.insert(M / 2);
  for (int i = 0; i < Ranges.size(); i++) {
    SS.insert(Ranges[i].first);
    SS.insert(Ranges[i].second + 1);
  }
  map<int, int> MM;
  int id = 0;
  vector<int> rev = {0};
  for (int x : SS) {
    MM[x] = ++id;
    rev.push_back(x);
  }
  vector<int> diff(id + 10);
  for (int i = 0; i < Ranges.size(); i++) {
    int l = Ranges[i].first, r = Ranges[i].second;
    l = MM[l], r = MM[r + 1];
    diff[l]++;
    diff[r]--;
  }
  int ans = 1e9, T = -1;
  for (int i = 1; i < id; i++) {
    if (i > 0) diff[i] += diff[i - 1];
    if (diff[i] < ans) {
      ans = diff[i], T = rev[i];
    }
  }
  vector<int> res;
  for (int i = 0; i < Ranges.size(); i++) {
    int l = Ranges[i].first, r = Ranges[i].second;
    if (l <= T && r >= T) res.push_back(who[i]);
  }
  cout << res.size() << " " << T << endl;
  for (int x : res) cout << x << " ";
  return 0;
}
