#include<bits/stdc++.h>
using namespace std;

#ifdef ONLINE_JUDGE
#define cerr if (false) cerr
#endif

#define fora(i, a, b) for (int i = (a); i < (b); i++)
#define ford(i, a, b) for (int i = (a); i >= (b); i--)
#define pr(x) cerr << #x << " = " << x << "\n";
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()

using ll = long long;
using ull = unsigned long long;

using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;

using vpii = vector<pii>;
using vpll = vector<pll>;
using vpdd = vector<pdd>;

const long double PI = 3.14159265358979323;
const long long MOD = 1e9 + 7;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); // uniform_int_distribution<int>(0, n)(rng)

ll rnd(ll n) {
    return uniform_int_distribution<ll>(0, n)(rng);
}

struct custom_hash { // unordered_map<long long, int, custom_hash> safe_map;
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return (size_t) splitmix64(x + FIXED_RANDOM);
    }
	size_t operator()(pair<uint64_t,uint64_t> x) const {
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
		return (size_t) (splitmix64(x.first + FIXED_RANDOM)^(splitmix64(x.second + FIXED_RANDOM) >> 1));
	}
};

ull modmul(ull a, ull b, ull M) {
	ll ret = a * b - M * ull(1.L / M * a * b);
	return ret + M * (ret < 0) - M * (ret >= (ll)M);
}

ll power(ll b, ll e, ll mod) {
	ull ans = 1;
	for (; e; b = modmul(b, b, mod), e /= 2)
		if (e & 1) ans = modmul(ans, b, mod);
	return ans;
}

long long modInverse(long long n, long long p) {
    return power(n, p-2, p);
}

long long ncr(long long arr[], long long n, long long r, long long p) {
    return ((arr[n] * modInverse(arr[r], p))%p * modInverse(arr[n-r], p))%p;
}

bool isPrime(ull n) {
	if (n < 2 || n % 6 % 4 != 1) return (n | 1) == 3;
	ull A[] = {2, 325, 9375, 28178, 450775, 9780504, 1795265022},
	    s = __builtin_ctzll(n-1), d = n >> s;
	for (ull a : A) {   // ^ count trailing zeroes
		ull p = power(a%n, d, n), i = s;
		while (p != 1 && p != n - 1 && a % n && i--)
			p = modmul(p, p, n);
		if (p != n-1 && i != s) return 0;
	}
	return 1;
}

ull pollard(ull n) {
	auto f = [n](ull x) { return modmul(x, x, n) + 1; };
	ull x = 0, y = 0, t = 0, prd = 2, i = 1, q;
	while (t++ % 40 || __gcd(prd, n) == 1) {
		if (x == y) x = ++i, y = f(x);
		if ((q = modmul(prd, max(x,y) - min(x,y), n))) prd = q;
		x = f(x), y = f(f(y));
	}
	return __gcd(prd, n);
}

vector<ull> factor(ull n) {
	if (n == 1) return {};
	if (isPrime(n)) return {n};
	ull x = pollard(n);
	auto l = factor(x), r = factor(n / x);
	l.insert(l.end(), all(r));
	return l;
}

struct Node {
    int nr;
    Node* parent;
    vector<Node*> edges;
    bool visited = false;
    bool active = false;
    int distance = 1e9;
    void reset() {
        visited = false;
        active = false;
        distance = 1e9;
    }
    void hardReset() {
        edges.clear();
        visited = false;
        active = false;
        distance = 1e9;
    }
};

list<Node*> activeNodes;

void dfs(Node* node) {
    if (node -> visited) {
        return;
    }
    activeNodes.push_back(node);
    node -> visited = true;
    node -> active = true;
    for (Node* newNode: node -> edges) {
        if (!newNode -> active) {
            newNode -> distance = min(newNode -> distance, node -> distance + 1);
        }
        if (!newNode -> visited) {
            dfs(newNode);
        }
    }
    activeNodes.pop_back();
    node -> active = false;
}

void bfs(Node* node) {
    if (node -> visited) {
        return;
    }
    node -> visited = true;
    node -> parent = node;
    node -> distance = 0;
    queue<Node*> q;
    for (q.push(node); !q.empty(); q.pop()) {
        node = q.front();
        for (Node* newNode: node -> edges) {
            if (!newNode -> visited) {
                newNode -> visited = true;
                newNode -> distance = node -> distance + 1;
                newNode -> parent = node;
                q.push(newNode);
            }
        }
    }
}

struct FenwickTree {
    vector<ll> s;
    FenwickTree(int n) : s(n) {}
    void update(int pos, ll dif) { // a[pos] += dif
        for (; pos < sz(s); pos |= pos + 1) s[pos] += dif;
    }
    ll query(int pos) { // sum of values in [0, pos)
        ll res = 0;
        for (; pos > 0; pos &= pos - 1) res += s[pos-1];
        return res;
    }
    int lower_bound(ll sum) {// min pos st sum of [0, pos] >= sum
        // Returns n if no sum is >= sum, or -1 if empty sum is.
        if (sum <= 0) return -1;
        int pos = 0;
        for (int pw = 1 << 25; pw; pw >>= 1) {
            if (pos + pw <= sz(s) && s[pos + pw-1] < sum)
                pos += pw, sum -= s[pos-1];
        }
        return pos;
    }
};

struct dep{ll h; ll m; int poz;};
bool c1(dep l, dep r) {
    if (l.m == r.m) {
        return l.h < r.h;
    }
    return l.m < r.m;
}
dep mas[100005];

unordered_map<ll, ll, custom_hash> x;
ll n,h,m,k,t,a,b,c,rez,sk;
string s1,s2;
list<ll> q;
set<ll> s;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> h >> m >> k;
    fora(i, 0, n) {
        cin >> mas[i].h >> mas[i].m;
        mas[i].poz = i+1;
        s.insert(mas[i].m);
    }
    sort(mas, mas+n, c1);
    int kk = 1;
    for (auto j: s) {
        x[j] = kk;
        kk++;
    }
    FenwickTree ft(kk + 10);

    fora(i, 0, n) {
        ft.update(x[mas[i].m], 1);
    }

    t = -1;
    rez = n;
    for (auto j: s) {
        sk = ft.query(x[j]);
        if (j - k >= 0) {
            if (s.upper_bound(j-k) != s.end()) {
                sk -= ft.query(x[*s.upper_bound(j-k)]);
            }
        } else {
            if (s.upper_bound(j-k+m) != s.end()) {
                sk += n;
                sk -= ft.query(x[*s.upper_bound(j-k+m)]);
            }
        }

//        cout << j << " " << (j + m/2)%m << "  " << sk << " ";

        if (s.upper_bound((j + m/2)%m) == s.end()) {
            sk += n;
        } else {
            sk += ft.query(x[*s.upper_bound((j + m/2)%m)]);
        }
        if ((j + m/2)%m - k >= 0) {
            if (s.upper_bound((j + m/2)%m-k) != s.end()) {
                sk -= ft.query(x[*s.upper_bound((j + m/2)%m-k)]);
            } else {
                sk -= n;
            }
        } else {
            if (s.upper_bound((j + m/2)%m-k+m) != s.end()) {
                sk += n;
                sk -= ft.query(x[*s.upper_bound((j + m/2)%m-k+m)]);
            }
        }
//        cout << sk << "\n";

        if (sk < rez) {
            rez = sk;
            t = j;
        }
    }
    q.clear();
    fora(i, 0, n) {
        int j = mas[i].m;
        int t2 = (t + m/2)%m;
        if (j < t && j > t - k) {
            q.push_back(mas[i].poz);
        } else if (t-k < 0 && t-k+m < j) {
            q.push_back(mas[i].poz);
        }
        else if (j < t2 && j > t2 - k) {
            q.push_back(mas[i].poz);
        } else if (t2-k < 0 && t2-k+m < j) {
            q.push_back(mas[i].poz);
        }
    }
    cout << rez << " " << t << "\n";
    for (auto j: q) {
        cout << j << " ";
    }
    return 0;
}


/*input
10 24 60 8
10 59
21 56
0 42
21 27
5 24
5 53
16 5
5 22
10 11
10 46

*/
#include<bits/stdc++.h>
#define ull         unsigned long long
#define ll             long long
#define M             1000000007
#define pb             push_back
#define p_q         priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define ios            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp             make_pair
#define lb             lower_bound
#define ub            upper_bound
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ini(a,n,b)    for(ll int i=0;i<n;i++) a[i]=0;
#define F            first
#define S            second
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

bool DEBUG = 0;

void solve()
{
    //initialize();
    ll n,h,m,k;cin>>n>>h>>m>>k;
    ll x,y;
    vi a;
    map < ll , vector < ll > > e;
    rep(i,0,n)
    {
        cin>>x>>y;
        y %= (m/2);
        e[y].pb(i+1);
        a.pb(y);
        a.pb((y-(m/2)));
        a.pb(((m/2)+ y));
    }
    ll l = k-1;
    sort(all(a));
    ll ans = n;
    rep(i,0,sz(a))
    {
        if (a[i] >= (m/2))
            break;
        ll p = lower_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();
        if (p == sz(a))
        {
            ans = min(ans , sz(a) - 1 - i);
        }
        else if (a[p] == a[i] + l)
        {
            ans = min(ans , p - i);
        }
        else
        {
            ans = min(ans , p-i-1);
        }
    }
    cout<<ans<<" ";
    vi bb;
    rep(i,0,sz(a))
    {
        if (a[i] >= (m/2))
            break;
        ll p = lower_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();
        ll a1 = -1;
        if (p == sz(a))
        {
            a1 =  sz(a) - 1 - i;
        }
        else if (a[p] == a[i] + l)
        {
            a1 = p - i;
        }
        else
        {
            a1 = p-i-1;
        }
        if (a1 == ans)
        {
            // cout<<"\n\n";
            ll left = ((a[i] + (m/2))%(m/2)) + 1;
            ll r = left + l - 1;
            ll l1 = r , l2 = left;
            // cout<<"\nll "<<left<<" "<<l1<<" "<<l2<<" "<<r<<"\n";
            left %= (m/2);
            r %= (m/2);
            if (left > r)
            {
                l1 = (m/2);
                l2 = 0;
            }
            // cout<<"\nll "<<left<<" "<<l1<<" "<<l2<<" "<<r<<"\n";
            cout<<r+1<<"\n";
            for(auto u : e)
            {
                if ((u.F >= left && u.F <= l1) || (u.F >= l2 && u.F <= r))
                {
                    for(auto o : u.S)
                    {
                        cout<<o<<" ";
                    }
                }
            }
            break;
        }
    }
    cout<<"\n";

}

int main(void)
{
    ios
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}


/*input
10 24 60 8
10 59
21 56
0 42
21 27
5 24
5 53
16 5
5 22
10 11
10 46

*/
#include<bits/stdc++.h>
#define ull         unsigned long long
#define ll             long long
#define M             1000000007
#define pb             push_back
#define p_q         priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define ios            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp             make_pair
#define lb             lower_bound
#define ub            upper_bound
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ini(a,n,b)    for(ll int i=0;i<n;i++) a[i]=0;
#define F            first
#define S            second
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

bool DEBUG = 0;

void solve()
{
    //initialize();
    ll n,h,m,k;cin>>n>>h>>m>>k;
    ll x,y;
    vi a;
    map < ll , vector < ll > > e;
    rep(i,0,n)
    {
        cin>>x>>y;
        e[y].pb(i+1);
        y %= (m/2);
        a.pb(y);
        a.pb((y-(m/2)));
        a.pb(((m/2)+ y));
    }
    ll l = k-1;
    sort(all(a));
    ll ans = n;
    rep(i,0,sz(a))
    {
        if (a[i] >= (m/2))
            break;
        ll p = lower_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();
        if (p == sz(a))
        {
            ans = min(ans , sz(a) - 1 - i);
        }
        else if (a[p] == a[i] + l)
        {
            ans = min(ans , p - i);
        }
        else
        {
            ans = min(ans , p-i-1);
        }
    }
    cout<<ans<<" ";
    vi bb;
    rep(i,0,sz(a))
    {
        if (a[i] >= (m/2))
            break;
        ll p = lower_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();
        ll a1 = -1;
        if (p == sz(a))
        {
            a1 =  sz(a) - 1 - i;
        }
        else if (a[p] == a[i] + l)
        {
            a1 = p - i;
        }
        else
        {
            a1 = p-i-1;
        }
        if (a1 == ans)
        {
            // cout<<"\n\n";
            ll left = ((a[i] + (m/2))%(m/2)) + 1;
            ll r = left + l - 1;
            left %= (m/2);
            r %= (m/2);
            ll l1 = r , l2 = l;
            // cout<<"\nll "<<left<<" "<<l1<<" "<<l2<<" "<<r<<"\n";
            if (left > r)
            {
                l1 = (m/2);
                l2 = 0;
            }
            // cout<<"\nll "<<left<<" "<<l1<<" "<<l2<<" "<<r<<"\n";
            cout<<r+1<<"\n";
            for(auto u : e)
            {
                if ((u.F >= left && u.F <= l1) || (u.F >= l2 && u.F <= r))
                {
                    for(auto o : u.S)
                    {
                        cout<<o<<" ";
                    }
                }
            }
            break;
        }
    }
    cout<<"\n";

}

int main(void)
{
    ios
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}


/*input
10 24 60 8
10 39
21 56
0 42
21 27
5 24
5 53
16 4
5 22
10 11
10 46

*/
#include<bits/stdc++.h>
#define ull         unsigned long long
#define ll             long long
#define M             1000000007
#define pb             push_back
#define p_q         priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define ios            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp             make_pair
#define lb             lower_bound
#define ub            upper_bound
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ini(a,n,b)    for(ll int i=0;i<n;i++) a[i]=0;
#define F            first
#define S            second
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

bool DEBUG = 0;

void solve()
{
    //initialize();
    ll n,h,m,k;cin>>n>>h>>m>>k;
    ll x,y;
    vi a;
    map < ll , vector < ll > > e;
    rep(i,0,n)
    {
        cin>>x>>y;
        y %= (m/2);
        e[y].pb(i+1);
        a.pb(y);
        a.pb((y-(m/2)));
        a.pb(((m/2)+ y));
    }
    ll l = k-1;
    sort(all(a));
    // rep(i,0,sz(a))
    // cout<<a[i]<<" ";
    // cout<<"\n";
    ll ans = n;
    rep(i,0,sz(a))
    {
        if (a[i] >= (m/2))
            break;
        ll p = lower_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();
        if (p == sz(a))
        {
            // cout<<"a "<<i<<" "<<a[i]+l<<" "<<(sz(a) - 1 - i)<<"\n";
            ans = min(ans , sz(a) - 1 - i);
        }
        else if (a[p] == a[i] + l)
        {
            p = upper_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();p--;
            // cout<<"b "<<i<<" "<<a[i]+l<<" "<<(p-i)<<"\n";
            ans = min(ans , p - i);
        }
        else
        {
            // cout<<"c "<<i<<" "<<a[i]+l<<" "<<(p - 1 - i)<<"\n";
            ans = min(ans , p-i-1);
        }
    }
    cout<<ans<<" ";
    vi bb;
    rep(i,0,sz(a))
    {
        if (a[i] >= (m/2))
            break;
        ll p = lower_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();
        ll a1 = -1;
        if (p == sz(a))
        {
            a1 =  sz(a) - 1 - i;
        }
        else if (a[p] == a[i] + l)
        {
            a1 = p - i;
        }
        else
        {
            a1 = p-i-1;
        }
        if (a1 == ans)
        {
            // cout<<"\n\n";
            ll left = ((a[i] + (m/2))%(m/2)) + 1;
            ll r = left + l - 1;
            left %= (m/2);
            r %= (m/2);
            ll l1 = r , l2 = left;
            // cout<<"\nll "<<left<<" "<<l1<<" "<<l2<<" "<<r<<"\n";
            if (left > r)
            {
                l1 = (m/2);
                l2 = 0;
            }
            // cout<<"\nll "<<left<<" "<<l1<<" "<<l2<<" "<<r<<"\n";
            cout<<r+1<<"\n";
            for(auto u : e)
            {
                if ((u.F >= left && u.F <= l1) || (u.F >= l2 && u.F <= r))
                {
                    for(auto o : u.S)
                    {
                        bb.pb(o);
                        // cout<<o<<" ";
                    }
                }
            }
            break;
        }
    }
    sort(all(bb));
    for(auto u:bb)
        cout<<u<<" ";
    cout<<"\n";

}

int main(void)
{
    ios
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}


/*input
10 24 60 8
10 59
21 56
0 42
21 27
5 24
5 53
16 5
5 22
10 11
10 46

*/
#include<bits/stdc++.h>
#define ull         unsigned long long
#define ll             long long
#define M             1000000007
#define pb             push_back
#define p_q         priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define ios            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp             make_pair
#define lb             lower_bound
#define ub            upper_bound
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ini(a,n,b)    for(ll int i=0;i<n;i++) a[i]=0;
#define F            first
#define S            second
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

bool DEBUG = 0;

void solve()
{
    //initialize();
    ll n,h,m,k;cin>>n>>h>>m>>k;
    ll x,y;
    vi a;
    map < ll , vector < ll > > e;
    rep(i,0,n)
    {
        cin>>x>>y;
        y %= (m/2);
        e[y].pb(i+1);
        a.pb(y);
        a.pb((y-(m/2)));
        a.pb(((m/2)+ y));
    }
    ll l = k-1;
    sort(all(a));
    ll ans = n;
    rep(i,0,sz(a))
    {
        if (a[i] >= (m/2))
            break;
        ll p = lower_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();
        if (p == sz(a))
        {
            ans = min(ans , sz(a) - 1 - i);
        }
        else if (a[p] == a[i] + l)
        {
            ans = min(ans , p - i);
        }
        else
        {
            ans = min(ans , p-i-1);
        }
    }
    cout<<ans<<" ";
    vi bb;
    rep(i,0,sz(a))
    {
        if (a[i] >= (m/2))
            break;
        ll p = lower_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();
        ll a1 = -1;
        if (p == sz(a))
        {
            a1 =  sz(a) - 1 - i;
        }
        else if (a[p] == a[i] + l)
        {
            a1 = p - i;
        }
        else
        {
            a1 = p-i-1;
        }
        if (a1 == ans)
        {
            // cout<<"\n\n";
            ll left = ((a[i] + (m/2))%(m/2)) + 1;
            ll r = left + l - 1;
            left %= (m/2);
            r %= (m/2);
            ll l1 = r , l2 = left;
            // cout<<"\nll "<<left<<" "<<l1<<" "<<l2<<" "<<r<<"\n";
            if (left > r)
            {
                l1 = (m/2);
                l2 = 0;
            }
            // cout<<"\nll "<<left<<" "<<l1<<" "<<l2<<" "<<r<<"\n";
            cout<<r+1<<"\n";
            for(auto u : e)
            {
                if ((u.F >= left && u.F <= l1) || (u.F >= l2 && u.F <= r))
                {
                    for(auto o : u.S)
                    {
                        cout<<o<<" ";
                    }
                }
            }
            break;
        }
    }
    cout<<"\n";

}

int main(void)
{
    ios
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}


/*input
1 1 2 1
0 1

*/
#include<bits/stdc++.h>
#define ull         unsigned long long
#define ll             long long
#define M             1000000007
#define pb             push_back
#define p_q         priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define ios            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp             make_pair
#define lb             lower_bound
#define ub            upper_bound
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ini(a,n,b)    for(ll int i=0;i<n;i++) a[i]=0;
#define F            first
#define S            second
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

bool DEBUG = 0;

void solve()
{
    //initialize();
    ll n,h,m,k;cin>>n>>h>>m>>k;
    ll x,y;
    vi a;
    map < ll , vector < ll > > e;
    rep(i,0,n)
    {
        cin>>x>>y;
        y %= (m/2);
        e[y].pb(i+1);
        a.pb(y);
        if (h != 1)
        {
            a.pb((y-(m/2)));
            a.pb(((m/2)+ y));
        }
    }
    ll l = k-1;
    sort(all(a));
    // rep(i,0,sz(a))
    // cout<<a[i]<<" ";
    // cout<<"\n";
    ll ans = n;
    if (l == 0)
    {
        cout<<"0 0\n\n";
        return;
    }
    rep(i,0,sz(a))
    {
        if (a[i] >= (m/2))
            break;
        ll p = lower_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();
        if (p == sz(a))
        {
            // cout<<"a "<<i<<" "<<a[i]+l<<" "<<(sz(a) - 1 - i)<<"\n";
            ans = min(ans , sz(a) - 1 - i);
        }
        else if (a[p] == a[i] + l)
        {
            p = upper_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();p--;
            // cout<<"b "<<i<<" "<<a[i]+l<<" "<<(p-i)<<"\n";
            ans = min(ans , p - i);
        }
        else
        {
            // cout<<"c "<<i<<" "<<a[i]+l<<" "<<(p - 1 - i)<<"\n";
            ans = min(ans , p-i-1);
        }
    }
    cout<<ans<<" ";
    vi bb;
    rep(i,0,sz(a))
    {
        if (a[i] >= (m/2))
            break;
        ll p = lower_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();
        ll a1 = -1;
        if (p == sz(a))
        {
            a1 =  sz(a) - 1 - i;
        }
        else if (a[p] == a[i] + l)
        {
            p = upper_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();p--;
            a1 = p - i;
        }
        else
        {
            a1 = p-i-1;
        }
        if (a1 == ans)
        {
            // cout<<"\n\n";
            ll left = ((a[i] + (m/2))%(m/2)) + 1;
            ll r = left + l - 1;
            left %= (m/2);
            r %= (m/2);
            ll l1 = r , l2 = left;
            // cout<<"\nll "<<left<<" "<<l1<<" "<<l2<<" "<<r<<"\n";
            if (left > r)
            {
                l1 = (m/2);
                l2 = 0;
            }
            // cout<<"\nll "<<left<<" "<<l1<<" "<<l2<<" "<<r<<"\n";
            cout<<r+1<<"\n";
            for(auto u : e)
            {
                if ((u.F >= left && u.F <= l1) || (u.F >= l2 && u.F <= r))
                {
                    for(auto o : u.S)
                    {
                        bb.pb(o);
                        // cout<<o<<" ";
                    }
                }
            }
            break;
        }
    }
    sort(all(bb));
    for(auto u:bb)
        cout<<u<<" ";
    cout<<"\n";

}

int main(void)
{
    ios
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}


/*input
10 24 60 8
10 39
21 56
0 42
21 27
5 24
5 53
16 4
5 22
10 11
10 46

*/
#include<bits/stdc++.h>
#define ull         unsigned long long
#define ll             long long
#define M             1000000007
#define pb             push_back
#define p_q         priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define ios            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp             make_pair
#define lb             lower_bound
#define ub            upper_bound
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ini(a,n,b)    for(ll int i=0;i<n;i++) a[i]=0;
#define F            first
#define S            second
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

bool DEBUG = 0;

void solve()
{
    //initialize();
    ll n,h,m,k;cin>>n>>h>>m>>k;
    ll x,y;
    vi a;
    map < ll , vector < ll > > e;
    rep(i,0,n)
    {
        cin>>x>>y;
        y %= (m/2);
        e[y].pb(i+1);
        a.pb(y);
        a.pb((y-(m/2)));
        a.pb(((m/2)+ y));
    }
    ll l = k-1;
    sort(all(a));
    // rep(i,0,sz(a))
    // cout<<a[i]<<" ";
    // cout<<"\n";
    ll ans = n;
    rep(i,0,sz(a))
    {
        if (a[i] >= (m/2))
            break;
        ll p = lower_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();
        if (p == sz(a))
        {
            // cout<<"a "<<i<<" "<<a[i]+l<<" "<<(sz(a) - 1 - i)<<"\n";
            ans = min(ans , sz(a) - 1 - i);
        }
        else if (a[p] == a[i] + l)
        {
            p = upper_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();p--;
            // cout<<"b "<<i<<" "<<a[i]+l<<" "<<(p-i)<<"\n";
            ans = min(ans , p - i);
        }
        else
        {
            // cout<<"c "<<i<<" "<<a[i]+l<<" "<<(p - 1 - i)<<"\n";
            ans = min(ans , p-i-1);
        }
    }
    cout<<ans<<" ";
    vi bb;
    rep(i,0,sz(a))
    {
        if (a[i] >= (m/2))
            break;
        ll p = lower_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();
        ll a1 = -1;
        if (p == sz(a))
        {
            a1 =  sz(a) - 1 - i;
        }
        else if (a[p] == a[i] + l)
        {
            p = upper_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();p--;
            a1 = p - i;
        }
        else
        {
            a1 = p-i-1;
        }
        if (a1 == ans)
        {
            // cout<<"\n\n";
            ll left = ((a[i] + (m/2))%(m/2)) + 1;
            ll r = left + l - 1;
            left %= (m/2);
            r %= (m/2);
            ll l1 = r , l2 = left;
            // cout<<"\nll "<<left<<" "<<l1<<" "<<l2<<" "<<r<<"\n";
            if (left > r)
            {
                l1 = (m/2);
                l2 = 0;
            }
            // cout<<"\nll "<<left<<" "<<l1<<" "<<l2<<" "<<r<<"\n";
            cout<<r+1<<"\n";
            for(auto u : e)
            {
                if ((u.F >= left && u.F <= l1) || (u.F >= l2 && u.F <= r))
                {
                    for(auto o : u.S)
                    {
                        bb.pb(o);
                        // cout<<o<<" ";
                    }
                }
            }
            break;
        }
    }
    sort(all(bb));
    for(auto u:bb)
        cout<<u<<" ";
    cout<<"\n";

}

int main(void)
{
    ios
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}


/*input
10 24 60 8
10 39
21 56
0 42
21 27
5 24
5 53
16 5
5 22
10 11
10 46

*/
#include<bits/stdc++.h>
#define ull         unsigned long long
#define ll             long long
#define M             1000000007
#define pb             push_back
#define p_q         priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define ios            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp             make_pair
#define lb             lower_bound
#define ub            upper_bound
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ini(a,n,b)    for(ll int i=0;i<n;i++) a[i]=0;
#define F            first
#define S            second
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

bool DEBUG = 0;

void solve()
{
    //initialize();
    ll n,h,m,k;cin>>n>>h>>m>>k;
    ll x,y;
    vi a;
    map < ll , vector < ll > > e;
    rep(i,0,n)
    {
        cin>>x>>y;
        y %= (m/2);
        e[y].pb(i+1);
        a.pb(y);
        a.pb((y-(m/2)));
        a.pb(((m/2)+ y));
    }
    ll l = k-1;
    sort(all(a));
    ll ans = n;
    rep(i,0,sz(a))
    {
        if (a[i] >= (m/2))
            break;
        ll p = lower_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();
        if (p == sz(a))
        {
            ans = min(ans , sz(a) - 1 - i);
        }
        else if (a[p] == a[i] + l)
        {
            ans = min(ans , p - i);
        }
        else
        {
            ans = min(ans , p-i-1);
        }
    }
    cout<<ans<<" ";
    vi bb;
    rep(i,0,sz(a))
    {
        if (a[i] >= (m/2))
            break;
        ll p = lower_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();
        ll a1 = -1;
        if (p == sz(a))
        {
            a1 =  sz(a) - 1 - i;
        }
        else if (a[p] == a[i] + l)
        {
            a1 = p - i;
        }
        else
        {
            a1 = p-i-1;
        }
        if (a1 == ans)
        {
            // cout<<"\n\n";
            ll left = ((a[i] + (m/2))%(m/2)) + 1;
            ll r = left + l - 1;
            left %= (m/2);
            r %= (m/2);
            ll l1 = r , l2 = left;
            // cout<<"\nll "<<left<<" "<<l1<<" "<<l2<<" "<<r<<"\n";
            if (left > r)
            {
                l1 = (m/2);
                l2 = 0;
            }
            // cout<<"\nll "<<left<<" "<<l1<<" "<<l2<<" "<<r<<"\n";
            cout<<r+1<<"\n";
            for(auto u : e)
            {
                if ((u.F >= left && u.F <= l1) || (u.F >= l2 && u.F <= r))
                {
                    for(auto o : u.S)
                    {
                        bb.pb(o);
                        // cout<<o<<" ";
                    }
                }
            }
            break;
        }
    }
    sort(all(bb));
    for(auto u:bb)
        cout<<u<<" ";
    cout<<"\n";

}

int main(void)
{
    ios
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}


/*input
1 1 2 1
0 1

*/
#include<bits/stdc++.h>
#define ull         unsigned long long
#define ll             long long
#define M             1000000007
#define pb             push_back
#define p_q         priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define ios            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp             make_pair
#define lb             lower_bound
#define ub            upper_bound
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ini(a,n,b)    for(ll int i=0;i<n;i++) a[i]=0;
#define F            first
#define S            second
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

bool DEBUG = 0;

void solve()
{
    //initialize();
    ll n,h,m,k;cin>>n>>h>>m>>k;
    ll x,y;
    vi a;
    map < ll , vector < ll > > e;
    rep(i,0,n)
    {
        cin>>x>>y;
        y %= (m/2);
        e[y].pb(i+1);
        a.pb(y);
        if (h != 1)
        {
            a.pb((y-(m/2)));
            a.pb(((m/2)+ y));
        }
    }
    ll l = k-1;
    sort(all(a));
    // rep(i,0,sz(a))
    // cout<<a[i]<<" ";
    // cout<<"\n";
    ll ans = n;
    if (l == 0)
    {
        cout<<"0 0\n\n";
        return;
    }
    rep(i,0,sz(a))
    {
        if (a[i] >= (m/2))
            break;
        ll p = lower_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();
        if (p == sz(a))
        {
            // cout<<"a "<<i<<" "<<a[i]+l<<" "<<(sz(a) - 1 - i)<<"\n";
            ans = min(ans , sz(a) - 1 - i);
        }
        else if (a[p] == a[i] + l)
        {
            p = upper_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();p--;
            // cout<<"b "<<i<<" "<<a[i]+l<<" "<<(p-i)<<"\n";
            ans = min(ans , p - i);
        }
        else
        {
            // cout<<"c "<<i<<" "<<a[i]+l<<" "<<(p - 1 - i)<<"\n";
            ans = min(ans , p-i-1);
        }
    }
    cout<<ans<<" ";
    vi bb;
    rep(i,0,sz(a))
    {
        if (a[i] >= (m/2))
            break;
        ll p = lower_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();
        ll a1 = -1;
        if (p == sz(a))
        {
            a1 =  sz(a) - 1 - i;
        }
        else if (a[p] == a[i] + l)
        {
            p = upper_bound(a.begin() , a.end() , (a[i] + l)) - a.begin();p--;
            a1 = p - i;
        }
        else
        {
            a1 = p-i-1;
        }
        if (a1 == ans)
        {
            // cout<<"\n\n";
            ll left = ((a[i] + (m/2))%(m/2)) + 1;
            ll r = left + l - 1;
            left %= (m/2);
            r %= (m/2);
            ll l1 = r , l2 = left;
            // cout<<"\nll "<<left<<" "<<l1<<" "<<l2<<" "<<r<<"\n";
            if (left > r)
            {
                l1 = (m/2);
                l2 = 0;
            }
            // cout<<"\nll "<<left<<" "<<l1<<" "<<l2<<" "<<r<<"\n";
            cout<<(r+1)%(m/2)<<"\n";
            for(auto u : e)
            {
                if ((u.F >= left && u.F <= l1) || (u.F >= l2 && u.F <= r))
                {
                    for(auto o : u.S)
                    {
                        bb.pb(o);
                        // cout<<o<<" ";
                    }
                }
            }
            break;
        }
    }
    sort(all(bb));
    for(auto u:bb)
        cout<<u<<" ";
    cout<<"\n";

}

int main(void)
{
    ios
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}


#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;
#define pll pair<ll, ll>
#define ppll pair<pair<ll, ll>, ll>
#define pb push_back

const ll maxn = ll(2e5) + 5;
const ll inf = ll(1e9) + 123;
const ll mod = ll(1e9) + 7;

ll n, h, m, k;
vector<pll> a;

void solve() {
    cin >> n >> h >> m >> k;
    for(ll i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        a.pb({y, i});
    }
    sort(a.begin(), a.end());
    for(ll i = 0; i < n; i++) {
        a.pb({a[i].first + m, a[i].second});
    }

    ll ans = inf;
    ll pos = -1;

    ll first = 0;
    for(ll i = 0; i <= n; i++) {
        ll l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first > first + m / 2) {
                r = mid;
            } else {
                l = mid;
            }
        }

        ll sec = r;

        l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first < first + m / 2 + k) {
                l = mid;
            } else {
                r = mid;
            }
        }

        ll cnt = max(ll(0), l - sec + 1);

        l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first > first) {
                r = mid;
            } else {
                l = mid;
            }
        }

        ll tmp = r;

        l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first < first + k) {
                l = mid;
            } else {
                r = mid;
            }
        }

        cnt += max(ll(0), l - tmp + 1);

        if(ans > cnt) {
            ans = cnt;
            pos = first;
        }

        l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first > first) {
                r = mid;
            } else {
                l = mid;
            }
        }

        tmp = r;

        l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first > first + m / 2) {
                r = mid;
            } else {
                l = mid;
            }
        }

        first += min(a[r].first - (first + m / 2), a[tmp].first - first);
    }

    cout << ans << " " << pos << endl;
    for(ll i = 0; i < 2 * n; i++) {
        if((pos < a[i].first && a[i].first < pos + k) ||
           (pos + m / 2 < a[i].first && a[i].first < pos + m / 2 + k)) {
            cout << a[i].second+1 << " ";
        }
    }
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("mpow.out", "w", stdout);

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //ll start = clock();
    solve();

    //cout << fixed << setprecision(3) << ld(1.0) * (clock() - start) / CLOCKS_PER_SEC << endl;

    return 0;
}


#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;
#define pll pair<ll, ll>
#define ppll pair<pair<ll, ll>, ll>
#define pb push_back

const ll maxn = ll(2e5) + 5;
const ll inf = ll(1e9) + 123;
const ll mod = ll(1e9) + 7;

ll n, h, m, k;
vector<pll> a;

void solve() {
    cin >> n >> h >> m >> k;
    for(ll i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        a.pb({y % (m / 2), i});
    }
    sort(a.begin(), a.end());
    for(ll i = 0; i < n; i++) {
        a.pb({a[i].first + m / 2, a[i].second});
    }

    ll ans = inf;
    ll pos = -1;

    ll first = 0;
    for(ll i = 0; i <= n; i++) {
        ll l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first > first) {
                r = mid;
            } else {
                l = mid;
            }
        }

        ll sec = r;

        l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first < first + k) {
                l = mid;
            } else {
                r = mid;
            }
        }

        ll cnt = max(ll(0), l - sec + 1);

        if(ans > cnt) {
            ans = cnt;
            pos = first;
        }

        l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first > first) {
                r = mid;
            } else {
                l = mid;
            }
        }

        first = a[r].first;
    }

    cout << ans << " " << pos << endl;
    for(ll i = 0; i < 2 * n; i++) {
        if((pos < a[i].first && a[i].first < pos + k)) {
            cout << a[i].second+1 << " ";
        }
    }
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("mpow.out", "w", stdout);

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //ll start = clock();
    solve();

    //cout << fixed << setprecision(3) << ld(1.0) * (clock() - start) / CLOCKS_PER_SEC << endl;

    return 0;
}


#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;
#define pll pair<ll, ll>
#define ppll pair<pair<ll, ll>, ll>
#define pb push_back

const ll maxn = ll(2e5) + 5;
const ll inf = ll(1e9) + 123;
const ll mod = ll(1e9) + 7;

ll n, h, m, k;
vector<pll> a;

void solve() {
    cin >> n >> h >> m >> k;
    for(ll i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        a.pb({y % (m / 2), i});
    }
    sort(a.begin(), a.end());
    for(ll i = 0; i < n; i++) {
        a.pb({a[i].first + m / 2, a[i].second});
    }
    for(ll i = 0; i < n; i++) {
        a.pb({a[i].first + m, a[i].second});
    }

    ll ans = inf;
    ll pos = -inf;

    ll first = 0;
    ll sec = 0;
    while(a[sec].first - a[first].first < k) sec++;
    for(ll i = 0; i < n; i++) {

        ll cnt = max(ll(0), sec - first - 1);

        if(ans > cnt) {
            ans = cnt;
            pos = a[first].first;
        }

        first++;
        while(a[sec].first - a[first].first < k) sec++;
    }

    assert(ans < inf);
    cout << ans << " " << (pos+k)%(m / 2) << endl;
    for(ll i = 0; i < 2 * n; i++) {
        if((pos < a[i].first && a[i].first < pos + k)) {
            cout << a[i].second+1 << " ";
        }
    }
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("mpow.out", "w", stdout);

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //ll start = clock();
    solve();

    //cout << fixed << setprecision(3) << ld(1.0) * (clock() - start) / CLOCKS_PER_SEC << endl;

    return 0;
}


#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;
#define pll pair<ll, ll>
#define ppll pair<pair<ll, ll>, ll>
#define pb push_back

const ll maxn = ll(2e5) + 5;
const ll inf = ll(1e9) + 123;
const ll mod = ll(1e9) + 7;

ll n, h, m, k;
vector<pll> a;

void solve() {
    cin >> n >> h >> m >> k;
    for(ll i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        a.pb({y % (m / 2), i});
    }
    sort(a.begin(), a.end());
    for(ll i = 0; i < n; i++) {
        a.pb({a[i].first + m / 2, a[i].second});
    }

    ll ans = inf;
    ll pos = -inf;

    ll first = 0;
    ll sec = 0;
    while(a[sec].first - a[first].first < k) sec++;
    for(ll i = 0; i < n; i++) {

        ll cnt = max(ll(0), sec - first);

        if(ans > cnt) {
            ans = cnt;
            pos = a[first].first;
        }

        first++;
        while(a[sec].first - a[first].first < k) sec++;
    }

    cout << ans-1 << " " << pos+k << endl;
    for(ll i = 0; i < 2 * n; i++) {
        if((pos < a[i].first && a[i].first < pos + k)) {
            cout << a[i].second+1 << " ";
        }
    }
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("mpow.out", "w", stdout);

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //ll start = clock();
    solve();

    //cout << fixed << setprecision(3) << ld(1.0) * (clock() - start) / CLOCKS_PER_SEC << endl;

    return 0;
}


#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;
#define pll pair<ll, ll>
#define ppll pair<pair<ll, ll>, ll>
#define pb push_back

const ll maxn = ll(2e5) + 5;
const ll inf = ll(1e9) + 123;
const ll mod = ll(1e9) + 7;

ll n, h, m, k;
vector<pll> a;

void solve() {
    cin >> n >> h >> m >> k;
    for(ll i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        a.pb({y % (m / 2), i});
    }
    sort(a.begin(), a.end());
    for(ll i = 0; i < n; i++) {
        a.pb({a[i].first + m / 2, a[i].second});
    }

    ll ans = inf;
    ll pos = -inf;

    ll first = 0;
    ll sec = 0;
    while(a[sec].first - a[first].first < k) sec++;
    for(ll i = 0; i < n; i++) {

        ll cnt = max(ll(0), sec - first);

        if(ans > cnt) {
            ans = cnt;
            pos = a[first].first;
        }

        first++;
        while(a[sec].first - a[first].first < k) sec++;
    }

    cout << ans-1 << " " << pos << endl;
    for(ll i = 0; i < 2 * n; i++) {
        if((pos < a[i].first && a[i].first < pos + k)) {
            cout << a[i].second+1 << " ";
        }
    }
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("mpow.out", "w", stdout);

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //ll start = clock();
    solve();

    //cout << fixed << setprecision(3) << ld(1.0) * (clock() - start) / CLOCKS_PER_SEC << endl;

    return 0;
}


#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;
#define pll pair<ll, ll>
#define ppll pair<pair<ll, ll>, ll>
#define pb push_back

const ll maxn = ll(2e5) + 5;
const ll inf = ll(1e9) + 123;
const ll mod = ll(1e9) + 7;

ll n, h, m, k;
vector<pll> a;

void solve() {
    cin >> n >> h >> m >> k;
    for(ll i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        a.pb({y % (m / 2), i});
    }
    sort(a.begin(), a.end());
    for(ll i = 0; i < n; i++) {
        a.pb({a[i].first + m / 2, a[i].second});
    }

    ll ans = inf;
    ll pos = -inf;

    ll first = 0;
    for(ll i = 0; i <= n; i++) {
        ll l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first > first) {
                r = mid;
            } else {
                l = mid;
            }
        }

        ll sec = r;

        l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first < first + k) {
                l = mid;
            } else {
                r = mid;
            }
        }

        ll cnt = max(ll(0), l - sec + 1);

        if(ans > cnt) {
            ans = cnt;
            pos = first;
        }

        l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first > first) {
                r = mid;
            } else {
                l = mid;
            }
        }

        first = a[r].first;
    }

    cout << ans << " " << pos << endl;
    for(ll i = 0; i < 2 * n; i++) {
        if((pos < a[i].first && a[i].first < pos + k)) {
            cout << a[i].second+1 << " ";
        }
    }
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("mpow.out", "w", stdout);

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //ll start = clock();
    solve();

    //cout << fixed << setprecision(3) << ld(1.0) * (clock() - start) / CLOCKS_PER_SEC << endl;

    return 0;
}


#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;
#define pll pair<ll, ll>
#define ppll pair<pair<ll, ll>, ll>
#define pb push_back

const ll maxn = ll(2e5) + 5;
const ll inf = ll(1e9) + 123;
const ll mod = ll(1e9) + 7;

ll n, h, m, k;
vector<pll> a;

void solve() {
    cin >> n >> h >> m >> k;
    for(ll i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        a.pb({y % (m / 2), i});
    }
    sort(a.begin(), a.end());
    for(ll i = 0; i < n; i++) {
        a.pb({a[i].first + m / 2, a[i].second});
    }
    for(ll i = 0; i < n; i++) {
        a.pb({a[i].first + m, a[i].second});
    }

    ll ans = inf;
    ll pos = -inf;

    ll first = 0;
    ll sec = 0;
    while(a[sec].first - a[first].first < k) sec++;
    for(ll i = 0; i < n; i++) {

        ll cnt = max(ll(0), sec - first - 1);

        if(ans > cnt) {
            ans = cnt;
            pos = a[first].first;
        }

        first++;
        while(a[sec].first - a[first].first < k) sec++;
    }

    assert(ans < inf);
    cout << ans << " " << pos+k << endl;
    for(ll i = 0; i < 2 * n; i++) {
        if((pos < a[i].first && a[i].first < pos + k)) {
            cout << a[i].second+1 << " ";
        }
    }
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("mpow.out", "w", stdout);

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //ll start = clock();
    solve();

    //cout << fixed << setprecision(3) << ld(1.0) * (clock() - start) / CLOCKS_PER_SEC << endl;

    return 0;
}


#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;
#define pll pair<ll, ll>
#define ppll pair<pair<ll, ll>, ll>
#define pb push_back

const ll maxn = ll(2e5) + 5;
const ll inf = ll(1e9) + 123;
const ll mod = ll(1e9) + 7;

ll n, h, m, k;
vector<pll> a;

void solve() {
    cin >> n >> h >> m >> k;
    for(ll i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        a.pb({y % (m / 2), i});
    }
    sort(a.begin(), a.end());
    for(ll i = 0; i < n; i++) {
        a.pb({a[i].first + m / 2, a[i].second});
    }

    ll ans = inf;
    ll pos = -inf;

    ll first = 0;
    ll sec = 0;
    while(a[sec].first - a[first].first < k) sec++;
    for(ll i = 0; i < n; i++) {

        ll cnt = max(ll(0), sec - first);

        if(ans > cnt) {
            ans = cnt;
            pos = a[first].first;
        }

        first++;
        while(a[sec].first - a[first].first < k) sec++;
    }

    assert(ans < inf);
    cout << ans-1 << " " << pos << endl;
    for(ll i = 0; i < 2 * n; i++) {
        if((pos < a[i].first && a[i].first < pos + k)) {
            cout << a[i].second+1 << " ";
        }
    }
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("mpow.out", "w", stdout);

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //ll start = clock();
    solve();

    //cout << fixed << setprecision(3) << ld(1.0) * (clock() - start) / CLOCKS_PER_SEC << endl;

    return 0;
}


#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;
#define pll pair<ll, ll>
#define ppll pair<pair<ll, ll>, ll>
#define pb push_back

const ll maxn = ll(2e5) + 5;
const ll inf = ll(1e9) + 123;
const ll mod = ll(1e9) + 7;

ll n, h, m, k;
vector<pll> a;

void solve() {
    cin >> n >> h >> m >> k;
    for(ll i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        a.pb({y % (m / 2), i});
    }
    sort(a.begin(), a.end());
    for(ll i = 0; i < n; i++) {
        a.pb({a[i].first + m / 2, a[i].second});
    }

    ll ans = inf;
    ll pos = -1;

    ll first = 0;
    for(ll i = 0; i <= n; i++) {
        ll l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first > first + m / 2) {
                r = mid;
            } else {
                l = mid;
            }
        }

        ll sec = r;

        l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first < first + m / 2 + k) {
                l = mid;
            } else {
                r = mid;
            }
        }

        ll cnt = max(ll(0), l - sec + 1);

        if(ans > cnt) {
            ans = cnt;
            pos = first;
        }

        l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first > first) {
                r = mid;
            } else {
                l = mid;
            }
        }

        ll tmp = r;

        l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first > first + m / 2) {
                r = mid;
            } else {
                l = mid;
            }
        }

        first += a[tmp].first - first;
    }

    cout << ans << " " << pos << endl;
    for(ll i = 0; i < 2 * n; i++) {
        if((pos < a[i].first && a[i].first < pos + k)) {
            cout << a[i].second+1 << " ";
        }
    }
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("mpow.out", "w", stdout);

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //ll start = clock();
    solve();

    //cout << fixed << setprecision(3) << ld(1.0) * (clock() - start) / CLOCKS_PER_SEC << endl;

    return 0;
}


#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;
#define pll pair<ll, ll>
#define ppll pair<pair<ll, ll>, ll>
#define pb push_back

const ll maxn = ll(2e5) + 5;
const ll inf = ll(1e9) + 123;
const ll mod = ll(1e9) + 7;

ll n, h, m, k;
vector<pll> a;

void solve() {
    cin >> n >> h >> m >> k;
    for(ll i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        a.pb({y % (m / 2), i});
    }
    sort(a.begin(), a.end());
    for(ll i = 0; i < n; i++) {
        a.pb({a[i].first + m / 2, a[i].second});
    }
    for(ll i = 0; i < n; i++) {
        a.pb({a[i].first + m, a[i].second});
    }

    ll ans = inf;
    ll pos = -inf;

    ll first = 0;
    ll sec = 0;
    while(a[sec].first - a[first].first < k) sec++;
    for(ll i = 0; i < n; i++) {

        ll cnt = max(ll(0), sec - first - 1);

        if(ans > cnt) {
            ans = cnt;
            pos = a[first].first;
        }

        first++;
        while(a[sec].first - a[first].first < k) sec++;
    }

    assert(ans < inf);
    cout << ans << " " << pos << endl;
    for(ll i = 0; i < 3 * n; i++) {
        if((pos < a[i].first && a[i].first < pos + k)) {
            cout << a[i].second+1 << " ";
        }
    }
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("mpow.out", "w", stdout);

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //ll start = clock();
    solve();

    //cout << fixed << setprecision(3) << ld(1.0) * (clock() - start) / CLOCKS_PER_SEC << endl;

    return 0;
}


#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;
#define pll pair<ll, ll>
#define ppll pair<pair<ll, ll>, ll>
#define pb push_back

const ll maxn = ll(2e5) + 5;
const ll inf = ll(1e9) + 123;
const ll mod = ll(1e9) + 7;

ll n, h, m, k;
vector<pll> a;

void solve() {
    cin >> n >> h >> m >> k;
    for(ll i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        a.pb({y % (m / 2), i});
    }
    sort(a.begin(), a.end());
    for(ll i = 0; i < n; i++) {
        a.pb({a[i].first + m / 2, a[i].second});
    }

    ll ans = inf;
    ll pos = -inf;

    ll first = 0;
    ll sec = 0;
    while(a[sec].first - a[first].first < k) sec++;
    for(ll i = 0; i < n; i++) {

        ll cnt = max(ll(0), sec - first);

        if(ans > cnt) {
            ans = cnt;
            pos = a[first].first;
        }

        first++;
        while(a[sec].first - a[first].first < k) sec++;
    }

    assert(ans < inf);
    cout << ans-1 << " " << pos << endl;
    for(ll i = 0; i < 2 * n; i++) {
        if((pos < a[i].first && a[i].first < pos + k)) {
            cout << a[i].second+1 << " ";
        }
    }
}

int main() {
    freopen("input.txt", "r", stdin);
    //freopen("mpow.out", "w", stdout);

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //ll start = clock();
    solve();

    //cout << fixed << setprecision(3) << ld(1.0) * (clock() - start) / CLOCKS_PER_SEC << endl;

    return 0;
}


#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;
#define pll pair<ll, ll>
#define ppll pair<pair<ll, ll>, ll>
#define pb push_back

const ll maxn = ll(2e5) + 5;
const ll inf = ll(1e9) + 123;
const ll mod = ll(1e9) + 7;

ll n, h, m, k;
vector<pll> a;

void solve() {
    cin >> n >> h >> m >> k;
    for(ll i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        a.pb({y, i});
    }
    sort(a.begin(), a.end());
    for(ll i = 0; i < n; i++) {
        a.pb({a[i].first + m, a[i].second});
    }

    ll ans = inf;
    ll pos = -1;

    ll first = 0;
    for(ll i = 0; i < n; i++) {
        ll l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first > first + m / 2) {
                r = mid;
            } else {
                l = mid;
            }
        }

        ll sec = r;

        l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first < first + m / 2 + k) {
                l = mid;
            } else {
                r = mid;
            }
        }

        ll cnt = max(ll(0), l - sec + 1);

        l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first > first) {
                r = mid;
            } else {
                l = mid;
            }
        }

        ll tmp = r;

        l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first < first + k) {
                l = mid;
            } else {
                r = mid;
            }
        }

        cnt += max(ll(0), l - tmp + 1);

        if(ans > cnt) {
            ans = cnt;
            pos = first;
        }

        l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first > first) {
                r = mid;
            } else {
                l = mid;
            }
        }

        tmp = r;

        l = -1, r = 2 * n;
        while(r - l > 1) {
            ll mid = (l + r) / 2;
            if(a[mid].first > first + m / 2) {
                r = mid;
            } else {
                l = mid;
            }
        }

        first += min(a[r].first - (first + m / 2), a[tmp].first - first);
    }

    cout << ans << " " << pos << endl;
    for(ll i = 0; i < 2 * n; i++) {
        if((pos < a[i].first && a[i].first < pos + k) ||
           (pos + m / 2 < a[i].first && a[i].first < pos + m / 2 + k)) {
            cout << a[i].second+1 << " ";
        }
    }
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("mpow.out", "w", stdout);

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //ll start = clock();
    solve();

    //cout << fixed << setprecision(3) << ld(1.0) * (clock() - start) / CLOCKS_PER_SEC << endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
typedef pair <int, int> ii;
typedef pair <ll, int> lli;
#define ar array
#define pb push_back
#define fi first
#define se second
#define sz size
#define mp make_pair
#define all(x) (x).begin(), (x).end()

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

struct chash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template <class T>
auto lbf(const std::set<std::pair<T, T>>& s, T first)
{
   static constexpr T min = std::numeric_limits<T>::min();

   return s.lower_bound({first, min});
}

int MOD = 1000000007;

ll pw(ll n, ll k) {
	ll r = 1;
	for(; k; k >>= 1) {
		if(k&1) r = r * n % MOD;
		n = n * n % MOD;
	}
	return r;
}
ll inv(ll n) { return pw(n, MOD-2); }

int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	int n, h, m, k;
	cin >> n >> h >> m >> k;
	vector<ii> tr;
	bool last = false;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if (b == m / 2 - 1 || b == m - 1) {
			last = true;
		}
		if (b >= m / 2) {
			b = b - m / 2;
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		} else {
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		}
		//tr[i + n] = {b + m, i + 1};
	}
	if (!last) {
		tr.pb({m / 2 - 1, -1});
	}
	sort(all(tr));
	int indL = 0, indR = 0, resL = 0, resR = n;
	debug() << tr;
	while (tr[indR].fi < 0) {
		indR++;
	}
	bool done = false;
	for (int i = indR; i < tr.size(); i++) {
		while (indL < i && tr[indL].fi + k <= tr[i].fi) {
			indL++;
		}
		if (i - indL < resR - resL) {
			resR = i;
			resL = indL;
		}
		//if (!done && tr[indR].fi >= 1 && k == 40362) {
			//cout << indR << " " << indL << endl;
			//done = true;
		//}
	}
	cout << resR - resL << " " << tr[resR].fi << endl;
	vector<int> res;
	for (int i = resL; i < resR; i++) {
		res.pb(tr[i].se);
	}
	sort(all(res));
	for (int i = 0; i < res.size(); i++) {
		cout << res[i] << " ";
	}
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
typedef pair <int, int> ii;
typedef pair <ll, int> lli;
#define ar array
#define pb push_back
#define fi first
#define se second
#define sz size
#define mp make_pair
#define all(x) (x).begin(), (x).end()

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

struct chash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template <class T>
auto lbf(const std::set<std::pair<T, T>>& s, T first)
{
   static constexpr T min = std::numeric_limits<T>::min();

   return s.lower_bound({first, min});
}

int MOD = 1000000007;

ll pw(ll n, ll k) {
	ll r = 1;
	for(; k; k >>= 1) {
		if(k&1) r = r * n % MOD;
		n = n * n % MOD;
	}
	return r;
}
ll inv(ll n) { return pw(n, MOD-2); }

int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	int n, h, m, k;
	cin >> n >> h >> m >> k;
	vector<ii> tr;
	bool last = false;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if (b == m / 2 - 1 || b == m - 1) {
			last = true;
		}
		if (b >= m / 2) {
			b = b - m / 2;
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		} else {
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		}
		//tr[i + n] = {b + m, i + 1};
	}
	if (!last) {
		tr.pb({m / 2 - 1, -1});
	}
	sort(all(tr));
	int indL = 0, indR = 0, resL = 0, resR = n;
	debug() << tr;
	while (tr[indR].fi < 0) {
		indR++;
	}
	bool done = false;
	for (int i = indR; i < tr.size(); i++) {
		while (indL < indR && tr[indL].fi + k <= tr[indR].fi) {
			indL++;
		}
		if (indR - indL < resR - resL) {
			resR = indR;
			resL = indL;
		}
		if (!done && tr[indR].fi >= 50 && k == 500000000) {
			cout << indR << " " << indL << endl;
			done = true;
		}
	}
	cout << resR - resL << " " << tr[resR].fi << endl;
	vector<int> res;
	for (int i = resL; i < resR; i++) {
		res.pb(tr[i].se);
	}
	sort(all(res));
	for (int i = 0; i < res.size(); i++) {
		cout << res[i] << " ";
	}
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
typedef pair <int, int> ii;
typedef pair <ll, int> lli;
#define ar array
#define pb push_back
#define fi first
#define se second
#define sz size
#define mp make_pair
#define all(x) (x).begin(), (x).end()

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

struct chash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template <class T>
auto lbf(const std::set<std::pair<T, T>>& s, T first)
{
   static constexpr T min = std::numeric_limits<T>::min();

   return s.lower_bound({first, min});
}

int MOD = 1000000007;

ll pw(ll n, ll k) {
	ll r = 1;
	for(; k; k >>= 1) {
		if(k&1) r = r * n % MOD;
		n = n * n % MOD;
	}
	return r;
}
ll inv(ll n) { return pw(n, MOD-2); }

int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	int n, h, m, k;
	cin >> n >> h >> m >> k;
	vector<ii> tr;
	bool last = false;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if (b == m / 2 - 1 || b == m - 1) {
			last = true;
		}
		if (b >= m / 2) {
			b = b - m / 2;
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		} else {
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		}
		//tr[i + n] = {b + m, i + 1};
	}
	if (!last) {
		tr.pb({m / 2 - 1, -1});
	}
	sort(all(tr));
	int indL = 0, indR = 0, resL = 0, resR = n;
	debug() << tr;
	while (tr[indR].fi < 0) {
		indR++;
	}
	for (int i = indR; i < tr.size(); i++) {
		while (indL < indR && tr[indL].fi + k <= tr[indR].fi) {
			indL++;
		}
		if (indR - indL < resR - resL) {
			resR = indR;
			resL = indL;
		}
		if (tr[indR].fi == 31242 && k == 40362) {
			cout << indR << " " << indL << endl;
		}
	}
	cout << resR - resL << " " << tr[resR].fi << endl;
	vector<int> res;
	for (int i = resL; i < resR; i++) {
		res.pb(tr[i].se);
	}
	sort(all(res));
	for (int i = 0; i < res.size(); i++) {
		cout << res[i] << " ";
	}
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
typedef pair <int, int> ii;
typedef pair <ll, int> lli;
#define ar array
#define pb push_back
#define fi first
#define se second
#define sz size
#define mp make_pair
#define all(x) (x).begin(), (x).end()

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

struct chash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template <class T>
auto lbf(const std::set<std::pair<T, T>>& s, T first)
{
   static constexpr T min = std::numeric_limits<T>::min();

   return s.lower_bound({first, min});
}

int MOD = 1000000007;

ll pw(ll n, ll k) {
	ll r = 1;
	for(; k; k >>= 1) {
		if(k&1) r = r * n % MOD;
		n = n * n % MOD;
	}
	return r;
}
ll inv(ll n) { return pw(n, MOD-2); }

int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	int n, h, m, k;
	cin >> n >> h >> m >> k;
	vector<ii> tr;
	bool last = false;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if (b == m / 2 - 1 || b == m - 1) {
			last = true;
		}
		if (b >= m / 2) {
			b = b - m / 2;
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		} else {
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		}
		//tr[i + n] = {b + m, i + 1};
	}
	if (!last) {
		tr.pb({m / 2 - 1, -1});
	}
	sort(all(tr));
	int indL = 0, indR = 0, resL = 0, resR = n;
	debug() << tr;
	while (tr[indR].fi < 0) {
		indR++;
	}
	bool done = false;
	for (int i = indR; i < tr.size(); i++) {
		while (indL < indR && tr[indL].fi + k <= tr[indR].fi) {
			indL++;
		}
		if (indR - indL < resR - resL) {
			resR = indR;
			resL = indL;
		}
		if (!done && tr[indR].fi >= 50 && k == 40362) {
			cout << indR << " " << indL << endl;
			done = true;
		}
	}
	cout << resR - resL << " " << tr[resR].fi << endl;
	vector<int> res;
	for (int i = resL; i < resR; i++) {
		res.pb(tr[i].se);
	}
	sort(all(res));
	for (int i = 0; i < res.size(); i++) {
		cout << res[i] << " ";
	}
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
typedef pair <int, int> ii;
typedef pair <ll, int> lli;
#define ar array
#define pb push_back
#define fi first
#define se second
#define sz size
#define mp make_pair
#define all(x) (x).begin(), (x).end()

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

struct chash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template <class T>
auto lbf(const std::set<std::pair<T, T>>& s, T first)
{
   static constexpr T min = std::numeric_limits<T>::min();

   return s.lower_bound({first, min});
}

int MOD = 1000000007;

ll pw(ll n, ll k) {
	ll r = 1;
	for(; k; k >>= 1) {
		if(k&1) r = r * n % MOD;
		n = n * n % MOD;
	}
	return r;
}
ll inv(ll n) { return pw(n, MOD-2); }

int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	int n, h, m, k;
	cin >> n >> h >> m >> k;
	vector<ii> tr(n * 2 + 1);
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if (b >= m / 2) {
			b = b - m / 2;
		}
		tr[i] = {b, i + 1};
		tr[i + n] = {b + m, i + 1};
	}
	tr[n * 2] = {m / 2 + m - 1, -1};
	sort(all(tr));
	int indL = 0, indR = n, resL = 0, resR = n;
	for (int i = indR; i <= 2 * n; i++) {
		while (indL < indR && tr[indL].fi + k <= tr[indR].fi) {
			indL++;
		}
		if (indR - indL < resR - resL) {
			resR = indR;
			resL = indL;
		}
	}
	cout << resR - resL << " " << tr[resR].fi - m << endl;
	vector<int> res;
	for (int i = resL; i < resR; i++) {
		res.pb(tr[i].se);
	}
	sort(all(res));
	for (int i = 0; i < res.size(); i++) {
		cout << res[i] << " ";
	}
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
typedef pair <int, int> ii;
typedef pair <ll, int> lli;
#define ar array
#define pb push_back
#define fi first
#define se second
#define sz size
#define mp make_pair
#define all(x) (x).begin(), (x).end()

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

struct chash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template <class T>
auto lbf(const std::set<std::pair<T, T>>& s, T first)
{
   static constexpr T min = std::numeric_limits<T>::min();

   return s.lower_bound({first, min});
}

int MOD = 1000000007;

ll pw(ll n, ll k) {
	ll r = 1;
	for(; k; k >>= 1) {
		if(k&1) r = r * n % MOD;
		n = n * n % MOD;
	}
	return r;
}
ll inv(ll n) { return pw(n, MOD-2); }

int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	int n, h, m, k;
	cin >> n >> h >> m >> k;
	vector<ii> tr;
	bool last = false;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if (b == m / 2 - 1 || b == m - 1) {
			last = true;
		}
		if (b >= m / 2) {
			b = b - m / 2;
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		} else {
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		}
		//tr[i + n] = {b + m, i + 1};
	}
	if (!last) {
		tr.pb({m / 2 - 1, -1});
	}
	sort(all(tr));
	int indL = 0, indR = 0, resL = 0, resR = n;
	debug() << tr;
	while (tr[indR].fi < 0) {
		indR++;
	}
	bool done = false;
	for (int i = indR; i < tr.size(); i++) {
		while (indL < indR && tr[indL].fi + k <= tr[indR].fi) {
			indL++;
		}
		if (indR - indL < resR - resL) {
			resR = indR;
			resL = indL;
		}
		if (!done && tr[indR].fi >= 31242 && k == 40362) {
			cout << indR << " " << indL << endl;
			done = true;
		}
	}
	cout << resR - resL << " " << tr[resR].fi << endl;
	vector<int> res;
	for (int i = resL; i < resR; i++) {
		res.pb(tr[i].se);
	}
	sort(all(res));
	for (int i = 0; i < res.size(); i++) {
		cout << res[i] << " ";
	}
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
typedef pair <int, int> ii;
typedef pair <ll, int> lli;
#define ar array
#define pb push_back
#define fi first
#define se second
#define sz size
#define mp make_pair
#define all(x) (x).begin(), (x).end()

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

struct chash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template <class T>
auto lbf(const std::set<std::pair<T, T>>& s, T first)
{
   static constexpr T min = std::numeric_limits<T>::min();

   return s.lower_bound({first, min});
}

int MOD = 1000000007;

ll pw(ll n, ll k) {
	ll r = 1;
	for(; k; k >>= 1) {
		if(k&1) r = r * n % MOD;
		n = n * n % MOD;
	}
	return r;
}
ll inv(ll n) { return pw(n, MOD-2); }

int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	int n, h, m, k;
	cin >> n >> h >> m >> k;
	vector<ii> tr(2 * n);
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		tr[i] = {b, i + 1};
		tr[i + n] = {b + m, i + 1};
	}
	sort(all(tr));
	int min = n;
	set<int> act, res;
	int indexU1 = 0;
	int indexD1 = 0;
	int indexU2 = 0;
	int indexD2 = 0;
	for (int i = 0; i < 2 * n; i++) {
		if (tr[i].fi >= m / 2) {
			indexU2 = i;
			indexD2 = i;
			break;
		}
	}
	int resM = 0;
	for (int i = 0; i < m / 2; i++) {
		while (indexU1 < 2 * n && tr[indexU1].fi < k + i) {
			act.insert(tr[indexU1].se);
			indexU1++;
		}
		while (indexD1 < 2 * n && tr[indexD1].fi <= i) {
			act.erase(tr[indexD1].se);
			indexD1++;
		}
		while (indexU2 < 2 * n && tr[indexU2].fi < k + i + m / 2) {
			act.insert(tr[indexU2].se);
			indexU2++;
		}
		while (indexD2 < 2 * n && tr[indexD2].fi <= i + m / 2) {
			act.erase(tr[indexD2].se);
			indexD2++;
		}
		if (act.size() < min) {
			res = act;
			min = act.size();
			resM = i + k;
		}
	}
	if (resM >= m / 2) {
		resM = resM - m / 2;
	}
	cout << min << " " << resM << endl;
	for (auto i = res.begin(); i != res.end(); i++) {
		cout << *i << " ";
	}
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
typedef pair <int, int> ii;
typedef pair <ll, int> lli;
#define ar array
#define pb push_back
#define fi first
#define se second
#define sz size
#define mp make_pair
#define all(x) (x).begin(), (x).end()

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

struct chash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template <class T>
auto lbf(const std::set<std::pair<T, T>>& s, T first)
{
   static constexpr T min = std::numeric_limits<T>::min();

   return s.lower_bound({first, min});
}

int MOD = 1000000007;

ll pw(ll n, ll k) {
	ll r = 1;
	for(; k; k >>= 1) {
		if(k&1) r = r * n % MOD;
		n = n * n % MOD;
	}
	return r;
}
ll inv(ll n) { return pw(n, MOD-2); }

int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	int n, h, m, k;
	cin >> n >> h >> m >> k;
	vector<ii> tr;
	bool last = false;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if (b == m / 2 - 1 || b == m - 1) {
			last = true;
		}
		if (b >= m / 2) {
			b = b - m / 2;
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		} else {
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		}
		//tr[i + n] = {b + m, i + 1};
	}
	if (!last) {
		tr.pb({m / 2 - 1, -1});
	}
	sort(all(tr));
	int indL = 0, indR = 0, resL = 0, resR = n;
	debug() << tr;
	while (tr[indR].fi < 0) {
		indR++;
	}
	bool done = false;
	for (int i = indR; i < tr.size(); i++) {
		while (indL < indR && tr[indL].fi + k <= tr[indR].fi) {
			indL++;
		}
		if (indR - indL < resR - resL) {
			resR = indR;
			resL = indL;
		}
		if (!done && k == 40362) {
			cout << indR << " " << indL << endl;
			done = true;
		}
	}
	cout << resR - resL << " " << tr[resR].fi << endl;
	vector<int> res;
	for (int i = resL; i < resR; i++) {
		res.pb(tr[i].se);
	}
	sort(all(res));
	for (int i = 0; i < res.size(); i++) {
		cout << res[i] << " ";
	}
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
typedef pair <int, int> ii;
typedef pair <ll, int> lli;
#define ar array
#define pb push_back
#define fi first
#define se second
#define sz size
#define mp make_pair
#define all(x) (x).begin(), (x).end()

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

struct chash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template <class T>
auto lbf(const std::set<std::pair<T, T>>& s, T first)
{
   static constexpr T min = std::numeric_limits<T>::min();

   return s.lower_bound({first, min});
}

int MOD = 1000000007;

ll pw(ll n, ll k) {
	ll r = 1;
	for(; k; k >>= 1) {
		if(k&1) r = r * n % MOD;
		n = n * n % MOD;
	}
	return r;
}
ll inv(ll n) { return pw(n, MOD-2); }

int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	int n, h, m, k;
	cin >> n >> h >> m >> k;
	vector<ii> tr;
	bool last = false;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if (b == m / 2 - 1 || b == m - 1) {
			last = true;
		}
		if (b >= m / 2) {
			b = b - m / 2;
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		} else {
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		}
		//tr[i + n] = {b + m, i + 1};
	}
	if (!last) {
		tr.pb({m / 2 - 1, -1});
	}
	sort(all(tr));
	int indL = 0, indR = 0, resL = 0, resR = n;
	while (tr[indR].fi < 0) {
		indR++;
	}
	bool done = false;
	for (int i = indR; i < tr.size(); i++) {
		while (indL < indR && tr[indL].fi + k <= tr[indR].fi) {
			indL++;
		}
		if (indR - indL < resR - resL) {
			resR = indR;
			resL = indL;
		}
		if (!done && tr[indR].fi >= 50 && k == 40362) {
			cout << indR << " " << indL << endl;
			done = true;
		}
	}
	cout << resR - resL << " " << tr[resR].fi << endl;
	vector<int> res;
	for (int i = resL; i < resR; i++) {
		res.pb(tr[i].se);
	}
	sort(all(res));
	for (int i = 0; i < res.size(); i++) {
		cout << res[i] << " ";
	}
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
typedef pair <int, int> ii;
typedef pair <ll, int> lli;
#define ar array
#define pb push_back
#define fi first
#define se second
#define sz size
#define mp make_pair
#define all(x) (x).begin(), (x).end()

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

struct chash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template <class T>
auto lbf(const std::set<std::pair<T, T>>& s, T first)
{
   static constexpr T min = std::numeric_limits<T>::min();

   return s.lower_bound({first, min});
}

int MOD = 1000000007;

ll pw(ll n, ll k) {
	ll r = 1;
	for(; k; k >>= 1) {
		if(k&1) r = r * n % MOD;
		n = n * n % MOD;
	}
	return r;
}
ll inv(ll n) { return pw(n, MOD-2); }

int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	int n, h, m, k;
	cin >> n >> h >> m >> k;
	vector<ii> tr;
	bool last = false;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if (b == m / 2 - 1 || b == m - 1) {
			last = true;
		}
		if (b >= m / 2) {
			b = b - m / 2;
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		} else {
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		}
		//tr[i + n] = {b + m, i + 1};
	}
	if (!last) {
		tr.pb({m / 2 - 1, -1});
	}
	sort(all(tr));
	int indL = 0, indR = 0, resL = 0, resR = n;
	debug() << tr;
	while (tr[indR].fi < 0) {
		indR++;
	}
	bool done = false;
	for (int i = indR; i < tr.size(); i++) {
		while (indL < indR && tr[indL].fi + k <= tr[indR].fi) {
			indL++;
		}
		if (indR - indL < resR - resL) {
			resR = indR;
			resL = indL;
		}
		if (!done && tr[indR].fi >= 50) {
			cout << indR << " " << indL << endl;
			done = true;
		}
	}
	cout << resR - resL << " " << tr[resR].fi << endl;
	vector<int> res;
	for (int i = resL; i < resR; i++) {
		res.pb(tr[i].se);
	}
	sort(all(res));
	for (int i = 0; i < res.size(); i++) {
		cout << res[i] << " ";
	}
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
typedef pair <int, int> ii;
typedef pair <ll, int> lli;
#define ar array
#define pb push_back
#define fi first
#define se second
#define sz size
#define mp make_pair
#define all(x) (x).begin(), (x).end()

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

struct chash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template <class T>
auto lbf(const std::set<std::pair<T, T>>& s, T first)
{
   static constexpr T min = std::numeric_limits<T>::min();

   return s.lower_bound({first, min});
}

int MOD = 1000000007;

ll pw(ll n, ll k) {
	ll r = 1;
	for(; k; k >>= 1) {
		if(k&1) r = r * n % MOD;
		n = n * n % MOD;
	}
	return r;
}
ll inv(ll n) { return pw(n, MOD-2); }

int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	int n, h, m, k;
	cin >> n >> h >> m >> k;
	vector<ii> tr;
	bool last = false;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if (b == m / 2 - 1 || b == m - 1) {
			last = true;
		}
		if (b >= m / 2) {
			b = b - m / 2;
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		} else {
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		}
		//tr[i + n] = {b + m, i + 1};
	}
	if (!last) {
		tr.pb({m / 2 - 1, -1});
	}
	sort(all(tr));
	int indL = 0, indR = 0, resL = 0, resR = n;
	debug() << tr;
	while (tr[indR].fi < 0) {
		indR++;
	}
	bool done = false;
	for (int i = indR; i < tr.size(); i++) {
		while (indL < indR && tr[indL].fi + k <= tr[indR].fi) {
			indL++;
		}
		if (indR - indL < resR - resL) {
			resR = indR;
			resL = indL;
		}
		//if (!done && tr[indR].fi >= 50 && k == 40362) {
			cout << indR << " " << indL << endl;
			done = true;
		//}
	}
	cout << resR - resL << " " << tr[resR].fi << endl;
	vector<int> res;
	for (int i = resL; i < resR; i++) {
		res.pb(tr[i].se);
	}
	sort(all(res));
	for (int i = 0; i < res.size(); i++) {
		cout << res[i] << " ";
	}
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
typedef pair <int, int> ii;
typedef pair <ll, int> lli;
#define ar array
#define pb push_back
#define fi first
#define se second
#define sz size
#define mp make_pair
#define all(x) (x).begin(), (x).end()

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

struct chash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template <class T>
auto lbf(const std::set<std::pair<T, T>>& s, T first)
{
   static constexpr T min = std::numeric_limits<T>::min();

   return s.lower_bound({first, min});
}

int MOD = 1000000007;

ll pw(ll n, ll k) {
	ll r = 1;
	for(; k; k >>= 1) {
		if(k&1) r = r * n % MOD;
		n = n * n % MOD;
	}
	return r;
}
ll inv(ll n) { return pw(n, MOD-2); }

int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	int n, h, m, k;
	cin >> n >> h >> m >> k;
	vector<ii> tr;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if (b >= m / 2) {
			b = b - m / 2;
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		} else {
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		}
		//tr[i + n] = {b + m, i + 1};
	}
	tr.pb({m / 2 - 1, -1});
	sort(all(tr));
	int indL = 0, indR = 0, resL = 0, resR = n;
	debug() << tr;
	while (tr[indR].fi < 0) {
		indR++;
	}
	for (int i = indR; i < tr.size(); i++) {
		while (indL < indR && tr[indL].fi + k <= tr[indR].fi) {
			indL++;
		}
		if (indR - indL < resR - resL) {
			resR = indR;
			resL = indL;
		}
	}
	cout << resR - resL << " " << tr[resR].fi << endl;
	vector<int> res;
	for (int i = resL; i < resR; i++) {
		res.pb(tr[i].se);
	}
	sort(all(res));
	for (int i = 0; i < res.size(); i++) {
		cout << res[i] << " ";
	}
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
typedef pair <int, int> ii;
typedef pair <ll, int> lli;
#define ar array
#define pb push_back
#define fi first
#define se second
#define sz size
#define mp make_pair
#define all(x) (x).begin(), (x).end()

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

struct chash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template <class T>
auto lbf(const std::set<std::pair<T, T>>& s, T first)
{
   static constexpr T min = std::numeric_limits<T>::min();

   return s.lower_bound({first, min});
}

int MOD = 1000000007;

ll pw(ll n, ll k) {
	ll r = 1;
	for(; k; k >>= 1) {
		if(k&1) r = r * n % MOD;
		n = n * n % MOD;
	}
	return r;
}
ll inv(ll n) { return pw(n, MOD-2); }

int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	int n, h, m, k;
	cin >> n >> h >> m >> k;
	vector<ii> tr;
	bool last = false;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if (b == m / 2 - 1 || b == m - 1) {
			last = true;
		}
		if (b >= m / 2) {
			b = b - m / 2;
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		} else {
			tr.pb({b, i + 1});
			tr.pb({b - m / 2, i + 1});
		}
		//tr[i + n] = {b + m, i + 1};
	}
	if (!last) {
		tr.pb({m / 2 - 1, -1});
	}
	sort(all(tr));
	int indL = 0, indR = 0, resL = 0, resR = n;
	debug() << tr;
	while (tr[indR].fi < 0) {
		indR++;
	}
	bool done = false;
	for (int i = indR; i < tr.size(); i++) {
		while (indL < indR && tr[indL].fi + k <= tr[indR].fi) {
			indL++;
		}
		if (indR - indL < resR - resL) {
			resR = indR;
			resL = indL;
		}
		if (!done && tr[indR].fi >= 1 && k == 40362) {
			cout << indR << " " << indL << endl;
			done = true;
		}
	}
	cout << resR - resL << " " << tr[resR].fi << endl;
	vector<int> res;
	for (int i = resL; i < resR; i++) {
		res.pb(tr[i].se);
	}
	sort(all(res));
	for (int i = 0; i < res.size(); i++) {
		cout << res[i] << " ";
	}
	cout << endl;
}