#include <bits/stdc++.h>
using namespace std;
const int N = 100010 * 6;
vector<int> numbers;
unordered_map<int, int> mp;
pair<int, int> trains[N];
void add(int x) {
  numbers.push_back(x - 1);
  numbers.push_back(x);
  numbers.push_back(x + 1);
}
int s[N], a[N];
int main() {
  int n, h, m, k;
  scanf("%d%d%d%d", &n, &h, &m, &k);
  numbers.reserve(n * 6);
  int m_half = m / 2;
  add(0);
  add(m_half);
  add(m);
  for (int i = 1; i <= n; ++i) {
    int hour, minute;
    scanf("%d%d", &hour, &minute);
    minute %= m_half;
    add(minute);
    add(minute + m_half);
    trains[i] = {minute, i};
  }
  sort(trains + 1, trains + n + 1);
  if (n == 1) {
    printf("0 %d\n\n", trains[1].first);
    return 0;
  }
  if (trains[1].first + m_half - trains[n].first >= k) {
    printf("0 %d\n\n", (trains[1].first + m_half) % m_half);
    return 0;
  }
  for (int i = 2; i <= n; ++i) {
    if (trains[i].first - trains[i - 1].first >= k) {
      printf("0 %d\n\n", trains[i].first);
      return 0;
    }
  }
  sort(numbers.begin(), numbers.end());
  auto number_tot = unique(numbers.begin(), numbers.end()) - numbers.begin();
  numbers.resize(number_tot);
  number_tot--;
  for (int i = 1; i <= number_tot; ++i) {
    mp[numbers[i]] = i;
  }
  if (0) {
    printf("%ld numbers\n", number_tot);
    for (int i = 1; i <= number_tot; ++i)
      printf("%d%c", numbers[i], " \n"[i == number_tot]);
  };
  for (int i = 1; i <= n; ++i) {
    a[mp[trains[i].first]]++;
    a[mp[trains[i].first + m_half]]++;
  }
  for (int i = 1; i <= number_tot; ++i) {
    s[i] = s[i - 1] + a[i];
  }
  if (0) {
    puts("a:");
    for (int i = 1; i <= number_tot; ++i)
      printf("%d%c", a[numbers[i]], " \n"[i == number_tot]);
    puts("s:");
    for (int i = 1; i <= number_tot; ++i)
      printf("%d%c", s[numbers[i]], " \n"[i == number_tot]);
  }
  int ans_t = -1, min_cancel = 1e9;
  for (int i = 1, j = 1; i <= number_tot; ++i) {
    int start = numbers[i];
    if (start >= m_half) break;
    int end = start + k;
    while (j < number_tot && numbers[j + 1] <= end) j++;
    int tot = s[j] - s[i - 1] - a[j] - a[i];
    if (tot < min_cancel) {
      if (0)
        printf("time range [%d, %d], index range [%d, %d], cancel_tot=%d\n",
               start, end, i, j, tot);
      ans_t = end % m_half;
      min_cancel = tot;
    }
  }
  printf("%d %d\n", min_cancel, ans_t);
  for (int i = 1; i <= n; ++i) {
    if (ans_t < k) {
      if ((trains[i].first < ans_t) || (trains[i].first > (ans_t + m_half - k)))
        printf("%d ", trains[i].second);
    } else {
      if (trains[i].first > ans_t - k && trains[i].first < ans_t)
        printf("%d ", trains[i].second);
    }
  }
  return 0;
}
