#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
#define N 100000

int n,h,m,k;
vector<int> nh,nm;

int main(){
	scanf("%d%d%d%d",&n,&h,&m,&k);
	nh=vector<int>(n);
	nm=vector<int>(n);
	for(int i=0;i<n;i++){
		scanf("%d",nh[i],nm[i]);
	}
	map<int,vector<int>> mp;
	for(int i=0;i<n;i++){
		mp[nm[i]%(m/2)].push_back(i+1);
	}
	if(k==1) {printf("0 0\n");printf("\n");return 0;}
	int mi=INT_MAX;
	int st=0;
	int all=0;
	auto it2=mp.begin();
	bool f=false;
	/*
	for(auto it=mp.begin();it!=mp.end();it++){
		int end=it->first+k-2;
		if(end>=m/2){
			if(!f) {
				f=true;
				while(it2!=mp.end()){
					all+=it2->second.size();
					it2++;
				}
				it2=mp.begin();
			}
			end=end%(m/2);
		}

		while(it2!=mp.end()&&it2->first<=end){
			all+=it2->second.size();
			it2++;
		}

		if(all<mi) {mi=all;st=it->first;}
		all-=it->second.size();
	}
	printf("%d %d\n",mi,st+k-1);

	for(auto it=mp.begin();it!=mp.end();it++){
		int end=st+k-2;
		if(it->first>=st&&it->first<=end||end>=m/2&&it->first<=end%(m/2)){
			for(int j=0;j<it->second.size();j++){
				printf("%d ",it->second[j]);
			}
		}
	}

	printf("\n");
	*/

	return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
#define N 100000

int n,h,m,k;
vector<int> nh,nm;

int main(){
	scanf("%d%d%d%d",&n,&h,&m,&k);
	nh=vector<int>(n);
	nm=vector<int>(n);
	for(int i=0;i<n;i++){
		scanf("%d",&nh[i],&nm[i]);
	}
	map<int,vector<int>> mp;
	for(int i=0;i<n;i++){
		mp[nm[i]%(m/2)].push_back(i+1);
	}
	if(k==1) {printf("0 0\n");printf("\n");return 0;}
	int mi=INT_MAX;
	int st=0;
	int all=0;
	auto it2=mp.begin();
	bool f=false;
	/*
	for(auto it=mp.begin();it!=mp.end();it++){
		int end=it->first+k-2;
		if(end>=m/2){
			if(!f) {
				f=true;
				while(it2!=mp.end()){
					all+=it2->second.size();
					it2++;
				}
				it2=mp.begin();
			}
			end=end%(m/2);
		}

		while(it2!=mp.end()&&it2->first<=end){
			all+=it2->second.size();
			it2++;
		}

		if(all<mi) {mi=all;st=it->first;}
		all-=it->second.size();
	}
	printf("%d %d\n",mi,st+k-1);

	for(auto it=mp.begin();it!=mp.end();it++){
		int end=st+k-2;
		if(it->first>=st&&it->first<=end||end>=m/2&&it->first<=end%(m/2)){
			for(int j=0;j<it->second.size();j++){
				printf("%d ",it->second[j]);
			}
		}
	}

	printf("\n");
	*/

	return 0;
}


#include<bits/stdc++.h>

using namespace std;
#define N 100000
typedef long long ll;

int n,h,m,k;
vector<int> nh,nm;
map<int,vector<int>> mp;

int main(){
	scanf("%d%d%d%d",&n,&h,&m,&k);
	nh=vector<int> (n);
	nm=vector<int> (n);
	for(int i=0;i<n;i++){
		scanf("%d%d",&nh[i],&nm[i]);
		mp[nm[i]%(m/2)].push_back(i+1);
	}
	if(n==1) {printf("0 0\n\n");return 0;}

	int ans=INT_MAX;
	int all=0;
	int st=0;
	auto it2=mp.begin();
	bool flag=false;
	for(auto it=mp.begin();it!=mp.end();it++){
		cout<<"here "<<it->first<<" "<<it->second<<endl;
		if(it2!=it) all-=it->second.size();
		int end=it->first+k-1;
		if(end>m/2){
			if(!flag){
				while(it2!=mp.end()){
					all+=it2->second.size();
					it2++;
				}
				it2=mp.begin();
			}
		}
		while(it2!=mp.end()&&it2->first>it->first&&it2->first<=end||end>(m/2)&&it2->first<=end%(m/2)){
			all+=it2->second.size();
			it2++;
		}
		if(all<ans) {ans=all;st=it->first;}
	}
	printf("%d %d\n",ans,(st+k)%(m/2));
	for(auto it=mp.begin();it!=mp.end();it++){
		int he=it->first;
		int end=st+k-1;
		if(he>st&&he<=end||end>m/2&&he<=end)
			for(int j=0;j<it->second.size();j++){
				printf("%d ",it->second[j]);
			}
	}
	printf("\n");
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
#define N 100000

int n,h,m,k;
vector<int> nh,nm;

int main(){
	scanf("%d%d%d%d",&n,&h,&m,&k);
	nh=vector<int>(n);
	nm=vector<int>(n);
	for(int i=0;i<n;i++){
		scanf("%d",nh[i],nm[i]);
	}
	map<int,vector<int>> mp;
	for(int i=0;i<n;i++){
		mp[nm[i]%(m/2)].push_back(i+1);
	}
	if(k==1) {printf("0 0\n");printf(" ");}
	int mi=INT_MAX;
	int st=0;
	int all=0;
	auto it2=mp.begin();
	bool f=false;
	for(auto it=mp.begin();it!=mp.end();it++){
		int end=it->first+k-2;
		if(end>m/2){
			if(!f) {
				f=true;
				while(it2!=mp.end()){
					all+=it2->second.size();
				}
				it2=mp.begin();
			}
			end=end%(m/2);
		}
		while(it2->first<=end){
			all+=it2->second.size();
			it2++;
		}
		if(all<mi) {mi=all;st=it->first;}
		all-=it->second.size();
	}
	printf("%d %d\n",mi,st+k-1);
	for(auto it=mp.begin();it!=mp.end();it++){
		int end=st+k-2;
		if(it->first>=st&&it->first<=end||end>m/2&&it->first<=end%(m/2)){
			for(int j=0;j<it->second.size();j++){
				printf("%d ",it->second[j]);
			}
		}
	}
	printf("\n");

	return 0;
}


#include<bits/stdc++.h>

using namespace std;
#define N 100000
typedef long long ll;

int n,h,m,k;
vector<int> nh,nm;
map<int,vector<int>> mp;

int main(){
	scanf("%d%d%d%d",&n,&h,&m,&k);
	nh=vector<int> (n);
	nm=vector<int> (n);
	for(int i=0;i<n;i++){
		scanf("%d%d",&nh[i],&nm[i]);
		mp[nm[i]%(m/2)].push_back(i+1);
	}
	if(n==1) {printf("0 0\n\n");return 0;}

	int ans=INT_MAX;
	int all=0;
	int st=0;
	auto it2=mp.begin();
	bool flag=false;
	for(auto it=mp.begin();it!=mp.end();it++){
		//cout<<"here "<<it->first<<" "<<it2->first<<endl;
		if(it2!=it) all-=it->second.size();
		else if(it==mp.back()) it2=mp.begin();
		else it2++;
		int end=it->first+k-1;
		if(end>m/2){
			if(!flag){
				while(it2!=mp.end()){
					all+=it2->second.size();
					it2++;
				}
				it2=mp.begin();
			}
		}
		while(it2!=mp.end()&&it2->first>it->first&&it2->first<=end||end>(m/2)&&it2->first<=end%(m/2)){
			all+=it2->second.size();
			it2++;
		}

		if(all<ans) {ans=all;st=it->first;}
	}
	printf("%d %d\n",ans,(st+k)%(m/2));
	for(auto it=mp.begin();it!=mp.end();it++){
		int he=it->first;
		int end=st+k-1;
		if(he>st&&he<=end||end>m/2&&he<=end)
			for(int j=0;j<it->second.size();j++){
				printf("%d ",it->second[j]);
			}
	}
	printf("\n");
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
#define N 100000
typedef long long ll;

int n,h,m,k;
vector<int> nh,nm;
map<int,vector<int>> mp;

int main(){
	scanf("%d%d%d%d",&n,&h,&m,&k);
	nh=vector<int> (n);
	nm=vector<int> (n);
	for(int i=0;i<n;i++){
		scanf("%d%d",&nh[i],&nm[i]);
		mp[nm[i]%(m/2)].push_back(i+1);
	}
	if(n==1) {printf("0 0\n\n");return 0;}

	int ans=INT_MAX;
	int all=0;
	int st=0;
	auto it2=mp.begin();
	bool flag=false;
	for(auto it=mp.begin();it!=mp.end();it++){
		//cout<<"here "<<it->first<<" "<<it2->first<<endl;
		if(it2!=it) all-=it->second.size();
		else if(it==--mp.end()) it2=mp.begin();
		else it2++;
		int end=it->first+k-1;
		if(end>m/2){
			if(!flag){
				while(it2!=mp.end()){
					all+=it2->second.size();
					it2++;
				}
				it2=mp.begin();
			}
		}
		while(it2!=mp.end()&&it2->first>it->first&&it2->first<=end||end>(m/2)&&it2->first<=end%(m/2)){
			all+=it2->second.size();
			it2++;
		}

		if(all<ans) {ans=all;st=it->first;}
	}
	printf("%d %d\n",ans,(st+k)%(m/2));
	for(auto it=mp.begin();it!=mp.end();it++){
		int he=it->first;
		int end=st+k-1;
		if(he>st&&he<=end||end>m/2&&he<=end)
			for(int j=0;j<it->second.size();j++){
				printf("%d ",it->second[j]);
			}
	}
	printf("\n");
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
#define N 100000

int n,h,m,k;
vector<int> nh,nm;

int main(){
	scanf("%d%d%d%d",&n,&h,&m,&k);
	nh=vector<int>(n);
	nm=vector<int>(n);
	for(int i=0;i<n;i++){
		scanf("%d",nh[i],nm[i]);
	}
	map<int,vector<int>> mp;
	for(int i=0;i<n;i++){
		mp[nm[i]%(m/2)].push_back(i+1);
	}
	if(k==1) {printf("0 0\n");printf(" ");}
	int mi=INT_MAX;
	int st=0;
	int all=0;
	auto it2=mp.begin();
	bool f=false;
	for(auto it=mp.begin();it!=mp.end();it++){
		int end=it->first+k-2;
		if(end>m/2){
			if(!f) {
				f=true;
				while(it2!=mp.end()){
					all+=it2->second.size();
				}
				it2=mp.begin();
			}
			end=end%(m/2);
		}
		while(it2->first<=end){
			all+=it2->second.size();
			it2++;
		}
		if(all<mi) {mi=all;st=it->first;}
		all-=it->second.size();
	}
	printf("%d %d\n",mi,st+k-1);
	for(auto it=mp.begin();it!=mp.end();it++){
		int end=st+k-2;
		if((it->first>=st&&it->first<=end||end>m/2&&it->first<=end%(m/2)){
			for(int j=0;j<it->second.size();j++){
				printf("%d ",it->second[j]);
			}
		}
	}
	printf("\n");

	return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

//template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//template<class T> using omultiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

//find_by_order
//order_of_key

#define x first
#define y second
#define pb push_back
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<pii> vii;
typedef vector<pll> vll;

const int N=1e5+5;

pll a[N];
ll b[N];

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n; cin >> n;
    ll h,m,k; cin >> h >> m >> k;
    for (int i=1; i<=n; ++i) {
        cin >> a[i].x >> a[i].y;
        b[i]=a[i].y;
    }
    sort(b+1,b+n+1);
    int ans1=n+1,ind=0,ans2=n+1;
    for (int i=1; i<=n; ++i) {
        ll l1=(b[i]-k+m)%m,r1=b[i];
        ll l2=b[i]+m/2,r2=b[i]+m/2;
        l2=(l2-k+m)%m;
        if (min(r1,r2) >= m/2)
            continue;
        int cur=0;
        if (l1 > r1) {
            int ind1=lower_bound(b+1,b+n+1,r1)-b-1,ind2=upper_bound(b+1,b+n+1,l1)-b;
            cur=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l1)-b,ind2=lower_bound(b+1,b+n+1,r1)-b-1;
            cur=max(0,ind2-ind1+1);
        }
        if (l2 > r2) {
            int ind1=lower_bound(b+1,b+n+1,r2)-b-1,ind2=upper_bound(b+1,b+n+1,l2)-b;
            cur+=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l2)-b,ind2=lower_bound(b+1,b+n+1,r2)-b-1;
            cur+=max(0,ind2-ind1+1);
        }
        if (cur < ans1) {
            ans1=cur;
            ind=i;
        }
    }
    ll t1=0,t2=0;
    vi res1,res2;
    if (ind) {
        ll l1=(b[ind]-k+m)%m,r1=b[ind];
        ll l2=b[ind]+m/2,r2=b[ind]+m/2;
        l2=(l2-k+m)%m;
        for (int i=1; i<=n; ++i) {
            if (l1 > r1 && (a[i].y < r1 || a[i].y > l1))
                res1.pb(i);
            else if (l1 < r1 && l1 < a[i].y && a[i].y < r1)
                res1.pb(i);
            else if (l2 > r2 && (a[i].y < r2 || a[i].y > l2))
                res1.pb(i);
            else if (l2 < r2 && l2 < a[i].y && a[i].y < r2)
                res1.pb(i);
        }
        t1=min(r1,r2);
    }
    ind=0;
    for (int i=1; i<=n; ++i) {
        ll l1=b[i],r1=(b[i]+k)%m;
        ll l2=b[i]+m/2,r2=b[i]+m/2;
        r2=(r2+k)%m;
        if (min(r1,r2) >= m/2)
            continue;
        int cur=0;
        if (l1 > r1) {
            int ind1=lower_bound(b+1,b+n+1,r1)-b-1,ind2=upper_bound(b+1,b+n+1,l1)-b;
            cur=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l1)-b,ind2=lower_bound(b+1,b+n+1,r1)-b-1;
            cur=max(0,ind2-ind1+1);
        }
        if (l2 > r2) {
            int ind1=lower_bound(b+1,b+n+1,r2)-b-1,ind2=upper_bound(b+1,b+n+1,l2)-b;
            cur+=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l2)-b,ind2=lower_bound(b+1,b+n+1,r2)-b-1;
            cur+=max(0,ind2-ind1+1);
        }
        if (cur < ans2) {
            ans2=cur;
            ind=i;
        }
    }
    if (ind) {
        ll l1=(b[ind]-k+m)%m,r1=b[ind];
        ll l2=b[ind]+m/2,r2=b[ind]+m/2;
        l2=(l2-k+m)%m;
        for (int i=1; i<=n; ++i) {
            if (l1 > r1 && (a[i].y < r1 || a[i].y > l1))
                res2.pb(i);
            else if (l1 < r1 && l1 < a[i].y && a[i].y < r1)
                res2.pb(i);
            else if (l2 > r2 && (a[i].y < r2 || a[i].y > l2))
                res2.pb(i);
            else if (l2 < r2 && l2 < a[i].y && a[i].y < r2)
                res2.pb(i);
        }
        t2=min(r1,r2);
    }
    if (ans1 < ans2) {
        cout << ans1 << " " << t1 << "\n";
        for (int i : res1)
            cout << i << " ";
    }
    else {
        cout << ans2 << " " << t1 << "\n";
        for (int i : res2)
            cout << i << " ";
    }
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

//template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//template<class T> using omultiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

//find_by_order
//order_of_key

#define x first
#define y second
#define pb push_back
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<pii> vii;
typedef vector<pll> vll;

const int N=1e5+5;

pll a[N];
ll b[N];

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n; cin >> n;
    ll h,m,k; cin >> h >> m >> k;
    for (int i=1; i<=n; ++i) {
        cin >> a[i].x >> a[i].y;
        b[i]=a[i].y;
    }
    sort(b+1,b+n+1);
    int ans1=n+1,ind=0,ans2=n+1;
    for (int i=1; i<=n; ++i) {
        ll l1=(b[i]-k+m)%m,r1=b[i];
        ll l2=(b[i]+m/2)%m,r2=(b[i]+m/2)%m;
        l2=(l2-k+m)%m;
        if (min(r1,r2) >= m/2)
            continue;
        int cur=0;
        if (l1 > r1) {
            int ind1=lower_bound(b+1,b+n+1,r1)-b-1,ind2=upper_bound(b+1,b+n+1,l1)-b;
            cur=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l1)-b,ind2=lower_bound(b+1,b+n+1,r1)-b-1;
            cur=max(0,ind2-ind1+1);
        }
        if (l2 > r2) {
            int ind1=lower_bound(b+1,b+n+1,r2)-b-1,ind2=upper_bound(b+1,b+n+1,l2)-b;
            cur+=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l2)-b,ind2=lower_bound(b+1,b+n+1,r2)-b-1;
            cur+=max(0,ind2-ind1+1);
        }
        if (cur < ans1) {
            ans1=cur;
            ind=i;
        }
    }
    ll t1=0,t2=0;
    vi res1,res2;
    if (ind) {
        ll l1=(b[ind]-k+m)%m,r1=b[ind];
        ll l2=(b[ind]+m/2)%m,r2=(b[ind]+m/2)%m;
        l2=(l2-k+m)%m;
        for (int i=1; i<=n; ++i) {
            if (l1 > r1 && (a[i].y < r1 || a[i].y > l1))
                res1.pb(i);
            else if (l1 < r1 && l1 < a[i].y && a[i].y < r1)
                res1.pb(i);
            else if (l2 > r2 && (a[i].y < r2 || a[i].y > l2))
                res1.pb(i);
            else if (l2 < r2 && l2 < a[i].y && a[i].y < r2)
                res1.pb(i);
        }
        t1=min(r1,r2);
    }
//    ind=0;
//    for (int i=1; i<=n; ++i) {
//        ll l1=b[i],r1=(b[i]+k)%m;
//        ll l2=(b[i]+m/2)%m,r2=(b[i]+m/2)%m;
//        r2=(r2+k)%m;
//        if (min(r1,r2) >= m/2)
//            continue;
//        int cur=0;
//        if (l1 > r1) {
//            int ind1=lower_bound(b+1,b+n+1,r1)-b-1,ind2=upper_bound(b+1,b+n+1,l1)-b;
//            cur=n-ind2+1+ind1;
//        }
//        else {
//            int ind1=upper_bound(b+1,b+n+1,l1)-b,ind2=lower_bound(b+1,b+n+1,r1)-b-1;
//            cur=max(0,ind2-ind1+1);
//        }
//        if (l2 > r2) {
//            int ind1=lower_bound(b+1,b+n+1,r2)-b-1,ind2=upper_bound(b+1,b+n+1,l2)-b;
//            cur+=n-ind2+1+ind1;
//        }
//        else {
//            int ind1=upper_bound(b+1,b+n+1,l2)-b,ind2=lower_bound(b+1,b+n+1,r2)-b-1;
//            cur+=max(0,ind2-ind1+1);
//        }
//        if (cur < ans2) {
//            ans2=cur;
//            ind=i;
//        }
//    }
//    if (ind) {
//        ll l1=b[ind],r1=(b[ind]+k)%m;
//        ll l2=(b[ind]+m/2)%m,r2=(b[ind]+m/2)%m;
//        r2=(r2+k)%m;
//        for (int i=1; i<=n; ++i) {
//            if (l1 > r1 && (a[i].y < r1 || a[i].y > l1))
//                res2.pb(i);
//            else if (l1 < r1 && l1 < a[i].y && a[i].y < r1)
//                res2.pb(i);
//            else if (l2 > r2 && (a[i].y < r2 || a[i].y > l2))
//                res2.pb(i);
//            else if (l2 < r2 && l2 < a[i].y && a[i].y < r2)
//                res2.pb(i);
//        }
//        t2=min(r1,r2);
//    }
    if (ans1 <= ans2) {
        cout << ans1 << " " << t1 << "\n";
        for (int i : res1)
            cout << i << " ";
    }
    else {
        cout << ans2 << " " << t2 << "\n";
        for (int i : res2)
            cout << i << " ";
    }
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

//template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//template<class T> using omultiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

//find_by_order
//order_of_key

#define x first
#define y second
#define pb push_back
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<pii> vii;
typedef vector<pll> vll;

const int N=1e5+5;

pll a[N];
ll b[N];

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n; cin >> n;
    ll h,m,k; cin >> h >> m >> k;
    for (int i=1; i<=n; ++i) {
        cin >> a[i].x >> a[i].y;
        b[i]=a[i].y;
    }
    sort(b+1,b+n+1);
    int ans=n+1,ind=0;
    for (int i=1; i<=n; ++i) {
        ll l1=(b[i]-k+m)%m,r1=b[i];
        ll l2=b[i]+m/2,r2=b[i]+m/2;
        l2=(l2-k+m)%m;
        if (min(r1,r2) >= m/2)
            continue;
        int cur=0;
        if (l1 > r1) {
            int ind1=lower_bound(b+1,b+n+1,r1)-b-1,ind2=upper_bound(b+1,b+n+1,l1)-b;
            cur=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l1)-b,ind2=lower_bound(b+1,b+n+1,r1)-b-1;
            cur=max(0,ind2-ind1+1);
        }
        if (l2 > r2) {
            int ind1=lower_bound(b+1,b+n+1,r2)-b-1,ind2=upper_bound(b+1,b+n+1,l2)-b;
            cur+=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l2)-b,ind2=lower_bound(b+1,b+n+1,r2)-b-1;
            cur+=max(0,ind2-ind1+1);
        }
        if (cur < ans) {
            ans=cur;
            ind=i;
        }
    }
    vi res;
    ll l1=(b[ind]-k+m)%m,r1=b[ind];
    ll l2=b[ind]+m/2,r2=b[ind]+m/2;
    l2=(l2-k+m)%m;
    for (int i=1; i<=n; ++i) {
        if (l1 > r1 && (a[i].y < r1 || a[i].y > l1))
            res.pb(i);
        else if (l1 < r1 && l1 < a[i].y && a[i].y < r1)
            res.pb(i);
        else if (l2 > r2 && (a[i].y < r2 || a[i].y > l2))
            res.pb(i);
        else if (l2 < r2 && l2 < a[i].y && a[i].y < r2)
            res.pb(i);
    }
    cout << res.size() << " " << min(r1,r2) << "\n";
    for (int i : res)
        cout << i << " ";
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

//template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//template<class T> using omultiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

//find_by_order
//order_of_key

#define x first
#define y second
#define pb push_back
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<pii> vii;
typedef vector<pll> vll;

const int N=1e5+5;

pll a[N];
ll b[N];

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n; cin >> n;
    ll h,m,k; cin >> h >> m >> k;
    for (int i=1; i<=n; ++i) {
        cin >> a[i].x >> a[i].y;
        b[i]=a[i].y;
    }
    sort(b+1,b+n+1);
    int ans1=n+1,ind=0,ans2=n+1;
    for (int i=1; i<=n; ++i) {
        ll l1=(b[i]-k+m)%m,r1=b[i];
        ll l2=b[i]+m/2,r2=b[i]+m/2;
        l2=(l2-k+m)%m;
        if (min(r1,r2) >= m/2)
            continue;
        int cur=0;
        if (l1 > r1) {
            int ind1=lower_bound(b+1,b+n+1,r1)-b-1,ind2=upper_bound(b+1,b+n+1,l1)-b;
            cur=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l1)-b,ind2=lower_bound(b+1,b+n+1,r1)-b-1;
            cur=max(0,ind2-ind1+1);
        }
        if (l2 > r2) {
            int ind1=lower_bound(b+1,b+n+1,r2)-b-1,ind2=upper_bound(b+1,b+n+1,l2)-b;
            cur+=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l2)-b,ind2=lower_bound(b+1,b+n+1,r2)-b-1;
            cur+=max(0,ind2-ind1+1);
        }
        if (cur < ans1) {
            ans1=cur;
            ind=i;
        }
    }
    ll t1=0,t2=0;
    vi res1,res2;
    if (ind) {
        ll l1=(b[ind]-k+m)%m,r1=b[ind];
        ll l2=b[ind]+m/2,r2=b[ind]+m/2;
        l2=(l2-k+m)%m;
        for (int i=1; i<=n; ++i) {
            if (l1 > r1 && (a[i].y < r1 || a[i].y > l1))
                res1.pb(i);
            else if (l1 < r1 && l1 < a[i].y && a[i].y < r1)
                res1.pb(i);
            else if (l2 > r2 && (a[i].y < r2 || a[i].y > l2))
                res1.pb(i);
            else if (l2 < r2 && l2 < a[i].y && a[i].y < r2)
                res1.pb(i);
        }
        t1=min(r1,r2);
    }
    ind=0;
    for (int i=1; i<=n; ++i) {
        ll l1=b[i],r1=(b[i]+k)%m;
        ll l2=b[i]+m/2,r2=b[i]+m/2;
        r2=(r2+k)%m;
        if (min(r1,r2) >= m/2)
            continue;
        int cur=0;
        if (l1 > r1) {
            int ind1=lower_bound(b+1,b+n+1,r1)-b-1,ind2=upper_bound(b+1,b+n+1,l1)-b;
            cur=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l1)-b,ind2=lower_bound(b+1,b+n+1,r1)-b-1;
            cur=max(0,ind2-ind1+1);
        }
        if (l2 > r2) {
            int ind1=lower_bound(b+1,b+n+1,r2)-b-1,ind2=upper_bound(b+1,b+n+1,l2)-b;
            cur+=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l2)-b,ind2=lower_bound(b+1,b+n+1,r2)-b-1;
            cur+=max(0,ind2-ind1+1);
        }
        if (cur < ans2) {
            ans2=cur;
            ind=i;
        }
    }
    if (ind) {
        ll l1=(b[ind]-k+m)%m,r1=b[ind];
        ll l2=b[ind]+m/2,r2=b[ind]+m/2;
        l2=(l2-k+m)%m;
        for (int i=1; i<=n; ++i) {
            if (l1 > r1 && (a[i].y < r1 || a[i].y > l1))
                res2.pb(i);
            else if (l1 < r1 && l1 < a[i].y && a[i].y < r1)
                res2.pb(i);
            else if (l2 > r2 && (a[i].y < r2 || a[i].y > l2))
                res2.pb(i);
            else if (l2 < r2 && l2 < a[i].y && a[i].y < r2)
                res2.pb(i);
        }
        t2=min(r1,r2);
    }
    if (ans1 < ans2) {
        cout << ans1 << " " << t1 << "\n";
        for (int i : res1)
            cout << i << " ";
    }
    else {
        cout << ans2 << " " << t2 << "\n";
        for (int i : res2)
            cout << i << " ";
    }
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

//template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//template<class T> using omultiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

//find_by_order
//order_of_key

#define x first
#define y second
#define pb push_back
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<pii> vii;
typedef vector<pll> vll;

const int N=1e5+5;

pll a[N];
ll b[N];

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n; cin >> n;
    ll h,m,k; cin >> h >> m >> k;
    for (int i=1; i<=n; ++i) {
        cin >> a[i].x >> a[i].y;
        b[i]=a[i].y;
    }
    sort(b+1,b+n+1);
    int ans1=n+1,ind=0,ans2=n+1;
    for (int i=1; i<=n; ++i) {
        ll l1=(b[i]-k+m)%m,r1=b[i];
        ll l2=(b[i]+m/2)%m,r2=(b[i]+m/2)%m;
        l2=(l2-k+m)%m;
        if (min(r1,r2) >= m/2)
            continue;
        int cur=0;
        if (l1 > r1) {
            int ind1=lower_bound(b+1,b+n+1,r1)-b-1,ind2=upper_bound(b+1,b+n+1,l1)-b;
            cur=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l1)-b,ind2=lower_bound(b+1,b+n+1,r1)-b-1;
            cur=max(0,ind2-ind1+1);
        }
        if (l2 > r2) {
            int ind1=lower_bound(b+1,b+n+1,r2)-b-1,ind2=upper_bound(b+1,b+n+1,l2)-b;
            cur+=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l2)-b,ind2=lower_bound(b+1,b+n+1,r2)-b-1;
            cur+=max(0,ind2-ind1+1);
        }
        if (cur < ans1) {
            ans1=cur;
            ind=i;
        }
    }
    ll t1=0,t2=0;
    vi res1,res2;
    if (ind) {
        ll l1=(b[ind]-k+m)%m,r1=b[ind];
        ll l2=(b[ind]+m/2)%m,r2=(b[ind]+m/2)%m;
        l2=(l2-k+m)%m;
        for (int i=1; i<=n; ++i) {
            if (l1 > r1 && (a[i].y < r1 || a[i].y > l1))
                res1.pb(i);
            else if (l1 < r1 && l1 < a[i].y && a[i].y < r1)
                res1.pb(i);
            else if (l2 > r2 && (a[i].y < r2 || a[i].y > l2))
                res1.pb(i);
            else if (l2 < r2 && l2 < a[i].y && a[i].y < r2)
                res1.pb(i);
        }
        t1=min(r1,r2);
    }
    ind=0;
    for (int i=1; i<=n; ++i) {
        ll l1=b[i],r1=(b[i]+k)%m;
        ll l2=(b[i]+m/2)%m,r2=(b[i]+m/2)%m;
        r2=(r2+k)%m;
        if (min(r1,r2) >= m/2)
            continue;
        int cur=0;
        if (l1 > r1) {
            int ind1=lower_bound(b+1,b+n+1,r1)-b-1,ind2=upper_bound(b+1,b+n+1,l1)-b;
            cur=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l1)-b,ind2=lower_bound(b+1,b+n+1,r1)-b-1;
            cur=max(0,ind2-ind1+1);
        }
        if (l2 > r2) {
            int ind1=lower_bound(b+1,b+n+1,r2)-b-1,ind2=upper_bound(b+1,b+n+1,l2)-b;
            cur+=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l2)-b,ind2=lower_bound(b+1,b+n+1,r2)-b-1;
            cur+=max(0,ind2-ind1+1);
        }
        if (cur < ans2) {
            ans2=cur;
            ind=i;
        }
    }
    if (ind) {
        ll l1=b[ind],r1=(b[ind]+k)%m;
        ll l2=(b[ind]+m/2)%m,r2=(b[ind]+m/2)%m;
        r2=(r2+k)%m;
        for (int i=1; i<=n; ++i) {
            if (l1 > r1 && (a[i].y < r1 || a[i].y > l1))
                res2.pb(i);
            else if (l1 < r1 && l1 < a[i].y && a[i].y < r1)
                res2.pb(i);
            else if (l2 > r2 && (a[i].y < r2 || a[i].y > l2))
                res2.pb(i);
            else if (l2 < r2 && l2 < a[i].y && a[i].y < r2)
                res2.pb(i);
        }
        t2=min(r1,r2);
    }
    if (ans1 <= ans2) {
        cout << ans1 << " " << t1 << "\n";
        for (int i : res1)
            cout << i << " ";
    }
    else {
        cout << ans2 << " " << t2 << "\n";
        for (int i : res2)
            cout << i << " ";
    }
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

//template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//template<class T> using omultiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

//find_by_order
//order_of_key

#define x first
#define y second
#define pb push_back
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<pii> vii;
typedef vector<pll> vll;

const int N=1e5+5;

pll a[N];
ll b[N];

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n; cin >> n;
    ll h,m,k; cin >> h >> m >> k;
    for (int i=1; i<=n; ++i) {
        cin >> a[i].x >> a[i].y;
        b[i]=a[i].y;
    }
    sort(b+1,b+n+1);
    int ans=n+1,ind=0;
    for (int i=1; i<=n; ++i) {
        ll l1=(b[i]-k+m)%m,r1=b[i];
        ll l2=(b[i]+m/2)%m,r2=(b[i]+m/2)%m;
        l2=(l2-k+m)%m;
        if (min(r1,r2) >= m/2)
            continue;
        int cur=0;
        if (l1 > r1) {
            int ind1=lower_bound(b+1,b+n+1,r1)-b-1,ind2=upper_bound(b+1,b+n+1,l1)-b;
            cur=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l1)-b,ind2=lower_bound(b+1,b+n+1,r1)-b-1;
            cur=max(0,ind2-ind1+1);
        }
        if (l2 > r2) {
            int ind1=lower_bound(b+1,b+n+1,r2)-b-1,ind2=upper_bound(b+1,b+n+1,l2)-b;
            cur+=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l2)-b,ind2=lower_bound(b+1,b+n+1,r2)-b-1;
            cur+=max(0,ind2-ind1+1);
        }
        if (cur < ans) {
            ans=cur;
            ind=i;
        }
    }
    ll t=0;
    vi res;
    if (ind) {
        ll l1=(b[ind]-k+m)%m,r1=b[ind];
        ll l2=(b[ind]+m/2)%m,r2=(b[ind]+m/2)%m;
        l2=(l2-k+m)%m;
        for (int i=1; i<=n; ++i) {
            if (l1 > r1 && (a[i].y < r1 || a[i].y > l1))
                res.pb(i);
            else if (l1 < r1 && l1 < a[i].y && a[i].y < r1)
                res.pb(i);
            else if (l2 > r2 && (a[i].y < r2 || a[i].y > l2))
                res.pb(i);
            else if (l2 < r2 && l2 < a[i].y && a[i].y < r2)
                res.pb(i);
        }
        t=min(r1,r2);
    }
    cout << ans << " " << t << "\n";
    for (int i : res)
        cout << i << " ";
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

//template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//template<class T> using omultiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

//find_by_order
//order_of_key

#define x first
#define y second
#define pb push_back
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<pii> vii;
typedef vector<pll> vll;

const int N=1e5+5;

pll a[N];
ll b[N];

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n; cin >> n;
    ll h,m,k; cin >> h >> m >> k;
    for (int i=1; i<=n; ++i) {
        cin >> a[i].x >> a[i].y;
        b[i]=a[i].y;
    }
    sort(b+1,b+n+1);
    int ans1=n+1,ind=0,ans2=n+1;
    for (int i=1; i<=n; ++i) {
        ll l1=(b[i]-k+m)%m,r1=b[i];
        ll l2=b[i]+m/2,r2=b[i]+m/2;
        l2=(l2-k+m)%m;
        if (min(r1,r2) >= m/2)
            continue;
        int cur=0;
        if (l1 > r1) {
            int ind1=lower_bound(b+1,b+n+1,r1)-b-1,ind2=upper_bound(b+1,b+n+1,l1)-b;
            cur=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l1)-b,ind2=lower_bound(b+1,b+n+1,r1)-b-1;
            cur=max(0,ind2-ind1+1);
        }
        if (l2 > r2) {
            int ind1=lower_bound(b+1,b+n+1,r2)-b-1,ind2=upper_bound(b+1,b+n+1,l2)-b;
            cur+=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l2)-b,ind2=lower_bound(b+1,b+n+1,r2)-b-1;
            cur+=max(0,ind2-ind1+1);
        }
        if (cur < ans1) {
            ans1=cur;
            ind=i;
        }
    }
    ll t1=0,t2=0;
    vi res1,res2;
    if (ind) {
        ll l1=(b[ind]-k+m)%m,r1=b[ind];
        ll l2=b[ind]+m/2,r2=b[ind]+m/2;
        l2=(l2-k+m)%m;
        for (int i=1; i<=n; ++i) {
            if (l1 > r1 && (a[i].y < r1 || a[i].y > l1))
                res1.pb(i);
            else if (l1 < r1 && l1 < a[i].y && a[i].y < r1)
                res1.pb(i);
            else if (l2 > r2 && (a[i].y < r2 || a[i].y > l2))
                res1.pb(i);
            else if (l2 < r2 && l2 < a[i].y && a[i].y < r2)
                res1.pb(i);
        }
        t1=min(r1,r2);
    }
    ind=0;
    for (int i=1; i<=n; ++i) {
        ll l1=b[i],r1=(b[i]+k)%m;
        ll l2=b[i]+m/2,r2=b[i]+m/2;
        r2=(r2+k)%m;
        if (min(r1,r2) >= m/2)
            continue;
        int cur=0;
        if (l1 > r1) {
            int ind1=lower_bound(b+1,b+n+1,r1)-b-1,ind2=upper_bound(b+1,b+n+1,l1)-b;
            cur=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l1)-b,ind2=lower_bound(b+1,b+n+1,r1)-b-1;
            cur=max(0,ind2-ind1+1);
        }
        if (l2 > r2) {
            int ind1=lower_bound(b+1,b+n+1,r2)-b-1,ind2=upper_bound(b+1,b+n+1,l2)-b;
            cur+=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l2)-b,ind2=lower_bound(b+1,b+n+1,r2)-b-1;
            cur+=max(0,ind2-ind1+1);
        }
        if (cur < ans2) {
            ans2=cur;
            ind=i;
        }
    }
    if (ind) {
        ll l1=b[ind],r1=(b[ind]+k)%m;
        ll l2=b[ind]+m/2,r2=b[ind]+m/2;
        r2=(r2+k)%m;
        for (int i=1; i<=n; ++i) {
            if (l1 > r1 && (a[i].y < r1 || a[i].y > l1))
                res2.pb(i);
            else if (l1 < r1 && l1 < a[i].y && a[i].y < r1)
                res2.pb(i);
            else if (l2 > r2 && (a[i].y < r2 || a[i].y > l2))
                res2.pb(i);
            else if (l2 < r2 && l2 < a[i].y && a[i].y < r2)
                res2.pb(i);
        }
        t2=min(r1,r2);
    }
    if (ans1 < ans2) {
        cout << ans1 << " " << t1 << "\n";
        for (int i : res1)
            cout << i << " ";
    }
    else {
        cout << ans2 << " " << t2 << "\n";
        for (int i : res2)
            cout << i << " ";
    }
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

//template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//template<class T> using omultiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

//find_by_order
//order_of_key

#define x first
#define y second
#define pb push_back
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<pii> vii;
typedef vector<pll> vll;

const int N=1e5+5;

pll a[N];
ll b[N];

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n; cin >> n;
    ll h,m,k; cin >> h >> m >> k;
    for (int i=1; i<=n; ++i) {
        cin >> a[i].x >> a[i].y;
        b[i]=a[i].y;
    }
    sort(b+1,b+n+1);
    int ans=n+1,ind=0;
    for (int i=1; i<=n; ++i) {
        ll l1=(b[i]-k+m)%m,r1=b[i];
        ll l2=b[i]+m/2,r2=b[i]+m/2;
        l2=(l2-k+m)%m;
        int cur=0;
        if (l1 > r1) {
            int ind1=lower_bound(b+1,b+n+1,r1)-b-1,ind2=upper_bound(b+1,b+n+1,l1)-b;
            cur=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l1)-b,ind2=lower_bound(b+1,b+n+1,r1)-b-1;
            cur=max(0,ind2-ind1+1);
        }
        if (l2 > r2) {
            int ind1=lower_bound(b+1,b+n+1,r2)-b-1,ind2=upper_bound(b+1,b+n+1,l2)-b;
            cur+=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l2)-b,ind2=lower_bound(b+1,b+n+1,r2)-b-1;
            cur+=max(0,ind2-ind1+1);
        }
        if (cur < ans) {
            ans=cur;
            ind=i;
        }
    }
    vi res;
    ll l1=(b[ind]-k+m)%m,r1=b[ind];
    ll l2=b[ind]+m/2,r2=b[ind]+m/2;
    l2=(l2-k+m)%m;
    for (int i=1; i<=n; ++i) {
        if (l1 > r1 && (a[i].y < r1 || a[i].y > l1))
            res.pb(i);
        else if (l1 < r1 && l1 < a[i].y && a[i].y < r1)
            res.pb(i);
        else if (l2 > r2 && (a[i].y < r2 || a[i].y > l2))
            res.pb(i);
        else if (l2 < r2 && l2 < a[i].y && a[i].y < r2)
            res.pb(i);
    }
    cout << res.size() << " " << min(r1,r2) << "\n";
    for (int i : res)
        cout << i << " ";
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

//template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//template<class T> using omultiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

//find_by_order
//order_of_key

#define x first
#define y second
#define pb push_back
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<pii> vii;
typedef vector<pll> vll;

const int N=1e5+5;

pll a[N];
ll b[N];

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n; cin >> n;
    ll h,m,k; cin >> h >> m >> k;
    for (int i=1; i<=n; ++i) {
        cin >> a[i].x >> a[i].y;
        b[i]=a[i].y;
    }
    sort(b+1,b+n+1);
    int ans=n+1,ind=0;
    for (int i=1; i<=n; ++i) {
        ll l1=(b[i]-k+m)%m,r1=b[i];
        ll l2=b[i]+m/2,r2=b[i]+m/2;
        l2=(l2-k+m)%m;
        cout << i << " " << l1 << " " << r1 << " " << l2 << " " << r2 << "\n";
        int cur=0;
        if (l1 > r1) {
            int ind1=lower_bound(b+1,b+n+1,r1)-b-1,ind2=upper_bound(b+1,b+n+1,l1)-b;
            cur=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l1)-b,ind2=lower_bound(b+1,b+n+1,r1)-b-1;
            cur=max(0,ind2-ind1+1);
        }
        if (l2 > r2) {
            int ind1=lower_bound(b+1,b+n+1,r2)-b-1,ind2=upper_bound(b+1,b+n+1,l2)-b;
            cur+=n-ind2+1+ind1;
        }
        else {
            int ind1=upper_bound(b+1,b+n+1,l2)-b,ind2=lower_bound(b+1,b+n+1,r2)-b-1;
            cur+=max(0,ind2-ind1+1);
        }
        if (cur < ans) {
            ans=cur;
            ind=i;
        }
    }
    vi res;
    ll l1=(b[ind]-k+m)%m,r1=b[ind];
    ll l2=b[ind]+m/2,r2=b[ind]+m/2;
    l2=(l2-k+m)%m;
    for (int i=1; i<=n; ++i) {
        if (l1 > r1 && (a[i].y < r1 || a[i].y > l1))
            res.pb(i);
        else if (l1 < r1 && l1 < a[i].y && a[i].y < r1)
            res.pb(i);
        else if (l2 > r2 && (a[i].y < r2 || a[i].y > l2))
            res.pb(i);
        else if (l2 < r2 && l2 < a[i].y && a[i].y < r2)
            res.pb(i);
    }
    cout << res.size() << " " << min(r1,r2) << "\n";
    for (int i : res)
        cout << i << " ";
}


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

typedef long long ll;
typedef pair <int , int> pii;
typedef long double ld;

const int N = 2e5+10 , mod = 1e9+7;

map <int , int> mp;
int mi[N];
int n , h , m , k;

bool ch(int time , int check){
   if((check > time && check - time < k) || (check < time && time + k >= m && (time + k) % m > check))
      return true;
   return false;
}

bool bad(int time , int check){
   return (ch(time , check) | ch((time + m / 2) % m , check));
}

map <int , int> fen;

void add(int x){
   x++;
   for( ; x < mod ; x += x & -x)
      fen[x]++;
}

int ask(int x){
   x++;
   int ret = 0;
   for( ; x ; x -= x & -x)
      ret += fen[x];
   return ret;
}

int get(int time){
   int num = 0;
   if(time + k >= m){
      num = ask(m - 1) - ask(time);
      int nw = (time + k) % m;
      num += ask(nw);
      num -= mp[nw];
   }
   else{
      num = ask(time + k) - ask(time);
      num -= mp[time + k];
   }
   return num;
}

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   cin >> n >> h >> m >> k;
   vector <int> st;
   for(int i = 0 ; i < n ; i++){
      int h;
      cin >> h >> mi[i];
      add(mi[i]);
      st.push_back(mi[i]);
      st.push_back((mi[i] - k + m) % m);
      mp[mi[i]]++;
   }
   sort(st.begin() , st.end());
   st.resize(unique(st.begin() , st.end()) - st.begin());
   int mn = mod , ans = -1;
   for(int i = 0 ; i < st.size() ; i++){
      int x = get(st[i]) + get((st[i] + m / 2) % m);
      if(x < mn){
         mn = x;
         ans = st[i];
      }
   }
   cout << mn << " " << (ans + k) % m << "\n";
   for(int i = 0 ; i < n ; i++)
      if(bad(ans , mi[i]))
         cout << i + 1 << " ";
   return 0;
}


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

typedef long long ll;
typedef pair <int , int> pii;
typedef long double ld;

const int N = 2e5+10 , mod = 1e9+7;

map <int , int> mp;
int mi[N];
int n , h , m , k;

bool ch(int time , int check){
   if((check > time && check - time < k) || (check < time && time + k >= m && (time + k) % m > check))
      return true;
   return false;
}

bool bad(int time , int check){
   return (ch(time , check) | ch((time + m / 2) % m , check));
}

map <int , int> fen;

void add(int x){
   x++;
   for( ; x < mod ; x += x & -x)
      fen[x]++;
}

int ask(int x){
   x++;
   int ret = 0;
   for( ; x ; x -= x & -x)
      ret += fen[x];
   return ret;
}

int get(int time){
   int num = 0;
   if(time + k >= m){
      num = ask(m - 1) - ask(time);
      int nw = (time + k) % m;
      num += ask(nw);
      num -= mp[nw];
   }
   else{
      num = ask(time + k) - ask(time);
      num -= mp[time + k];
   }
   return num;
}

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   cin >> n >> h >> m >> k;
   vector <int> st;
   for(int i = 0 ; i < n ; i++){
      int h;
      cin >> h >> mi[i];
      add(mi[i]);
      st.push_back(mi[i]);
      st.push_back((mi[i] - k + m) % m);
      mp[mi[i]]++;
   }
   sort(st.begin() , st.end());
   st.resize(unique(st.begin() , st.end()) - st.begin());
   int mn = mod , ans = -1;
   for(int i = 0 ; i < st.size() ; i++){
      int x = get(st[i]) + get((st[i] + m / 2) % m);
      if(x < mn){
         mn = x;
         ans = st[i];
      }
   }
   cout << mn << " " << ans << "\n";
   for(int i = 0 ; i < n ; i++)
      if(bad(ans , mi[i]))
         cout << i + 1 << " ";
   return 0;
}


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

typedef long long ll;
typedef pair <int , int> pii;
typedef long double ld;

const int N = 2e5+10 , mod = 1e9+7;

unordered_map <int , int> mp;
int mi[N];
int n , h , m , k;

inline bool ch(int time , int check){
   if((check > time && check - time < k) || (check < time && time + k >= m && (time + k) % m > check))
      return true;
   return false;
}

inline bool bad(int time , int check){
   return (ch(time , check) | ch((time + m / 2) % m , check));
}

unordered_map <int , int> fen;

inline void add(int x){
   x++;
   for( ; x < mod ; x += x & -x)
      fen[x]++;
}

inline int ask(int x){
   x++;
   int ret = 0;
   for( ; x ; x -= x & -x)
      ret += fen[x];
   return ret;
}

inline int get(int time){
   int num = 0;
   if(time + k >= m){
      num = ask(m - 1) - ask(time);
      int nw = (time + k) % m;
      num += ask(nw);
      num -= mp[nw];
   }
   else{
      num = ask(time + k) - ask(time);
      num -= mp[time + k];
   }
   return num;
}

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   cin >> n >> h >> m >> k;
   vector <int> st;
   for(int i = 0 ; i < n ; i++){
      int h;
      cin >> h >> mi[i];
      add(mi[i]);
      st.push_back(mi[i]);
      st.push_back((mi[i] - k + m) % m);
      mp[mi[i]]++;
   }
   sort(st.begin() , st.end());
   st.resize(unique(st.begin() , st.end()) - st.begin());
   int mn = mod , ans = -1;
   for(int i = 0 ; i < st.size() ; i++){
      int x = get(st[i]) + get((st[i] + m / 2) % m);
      if(x < mn){
         mn = x;
         ans = st[i];
      }
   }
   int ret = (ans + k) % m;
   if(ret >= m / 2)
      ret -= m / 2;
   cout << mn << " " << ret << "\n";
   for(int i = 0 ; i < n ; i++)
      if(bad(ans , mi[i]))
         cout << i + 1 << " ";
   return 0;
}


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

typedef long long ll;
typedef pair <int , int> pii;
typedef long double ld;

const int N = 2e5+10 , mod = 1e9+7;

unordered_map <int , int> mp;
int mi[N];
int n , h , m , k;

inline bool ch(int time , int check){
   if((check > time && check - time < k) || (check < time && time + k >= m && (time + k) % m > check))
      return true;
   return false;
}

inline bool bad(int time , int check){
   return (ch(time , check) | ch((time + m / 2) % m , check));
}

unordered_map <int , int> fen;

inline void add(int x){
   x++;
   for( ; x < mod ; x += x & -x)
      fen[x]++;
}

inline int ask(int x){
   x++;
   int ret = 0;
   for( ; x ; x -= x & -x)
      ret += fen[x];
   return ret;
}

inline int get(int time){
   int num = 0;
   if(time + k >= m){
      num = ask(m - 1) - ask(time);
      int nw = (time + k) % m;
      num += ask(nw);
      num -= mp[nw];
   }
   else{
      num = ask(time + k) - ask(time);
      num -= mp[time + k];
   }
   return num;
}

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   cin >> n >> h >> m >> k;
   vector <int> st;
   for(int i = 0 ; i < n ; i++){
      int h;
      cin >> h >> mi[i];
      add(mi[i]);
      if(mi[i] >= m / 2)
         st.push_back(mi[i] - m / 2);
      else
         st.push_back(mi[i]);
      mp[mi[i]]++;
   }
   sort(st.begin() , st.end());
   st.resize(unique(st.begin() , st.end()) - st.begin());
   int mn = mod , ans = -1;
   for(int i = 0 ; i < st.size() ; i++){
      int x = get(st[i]) + get((st[i] + m / 2) % m);
      if(x < mn){
         mn = x;
         ans = st[i];
      }
   }
   int ret = (ans + k) % m;
   if(ret >= m / 2)
      ret -= m / 2;
   cout << mn << " " << ret << "\n";
   for(int i = 0 ; i < n ; i++)
      if(bad(ans , mi[i]))
         cout << i + 1 << " ";
   return 0;
}


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

typedef long long ll;
typedef pair <int , int> pii;
typedef long double ld;

const int N = 2e5+10 , mod = 1e9+7;

map <int , int> mp;
int mi[N];
int n , h , m , k;

bool ch(int time , int check){
   if((check > time && check - time < k) || (check < time && time + k >= m && (time + k) % m > check))
      return true;
   return false;
}

bool bad(int time , int check){
   return (ch(time , check) | ch((time + m / 2) % m , check));
}

map <int , int> fen;

void add(int x){
   x++;
   for( ; x < mod ; x += x & -x)
      fen[x]++;
}

int ask(int x){
   x++;
   int ret = 0;
   for( ; x ; x -= x & -x)
      ret += fen[x];
   return ret;
}

int get(int time){
   int num = 0;
   if(time + k >= m){
      num = ask(m - 1) - ask(time);
      int nw = (time + k) % m;
      num += ask(nw);
      num -= mp[nw];
   }
   else{
      num = ask(time + k) - ask(time);
      num -= mp[time + k];
   }
   return num;
}

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   cin >> n >> h >> m >> k;
   vector <int> st;
   for(int i = 0 ; i < n ; i++){
      int h;
      cin >> h >> mi[i];
      add(mi[i]);
      st.push_back(mi[i]);
      st.push_back((mi[i] - k + m) % m);
      mp[mi[i]]++;
   }
   sort(st.begin() , st.end());
   st.resize(unique(st.begin() , st.end()) - st.begin());
   int mn = mod , ans = -1;
   for(int i = 0 ; i < st.size() ; i++){
      int x = get(st[i]) + get((st[i] + m / 2) % m);
      if(x < mn){
         mn = x;
         ans = st[i];
      }
   }
   int ret = (ans + k) % m;
   if(ret >= m / 2)
      ret -= m / 2;
   cout << mn << " " << ret << "\n";
   for(int i = 0 ; i < n ; i++)
      if(bad(ans , mi[i]))
         cout << i + 1 << " ";
   return 0;
}


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

typedef long long ll;
typedef pair <int , int> pii;
typedef long double ld;

const int N = 2e5+10 , mod = 1e9+7;

unordered_map <int , int> mp;
int mi[N];
int n , h , m , k;

inline bool ch(int time , int check){
   if((check > time && check - time < k) || (check < time && time + k >= m && (time + k) % m > check))
      return true;
   return false;
}

inline bool bad(int time , int check){
   return (ch(time , check) | ch((time + m / 2) % m , check));
}

unordered_map <int , int> fen;

inline void add(int x){
   x++;
   for( ; x < mod ; x += x & -x)
      fen[x]++;
}

inline int ask(int x){
   x++;
   int ret = 0;
   for( ; x ; x -= x & -x)
      ret += fen[x];
   return ret;
}

inline int get(int time){
   int num = 0;
   if(time + k >= m){
      num = ask(m - 1) - ask(time);
      int nw = (time + k) % m;
      num += ask(nw);
      num -= mp[nw];
   }
   else{
      num = ask(time + k) - ask(time);
      num -= mp[time + k];
   }
   return num;
}

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   cin >> n >> h >> m >> k;
   vector <int> st;
   for(int i = 0 ; i < n ; i++){
      int h;
      cin >> h >> mi[i];
      add(mi[i]);
      st.push_back(mi[i]);
      st.push_back((mi[i] - k + m) % m);
      mp[mi[i]]++;
   }
   sort(st.begin() , st.end());
   st.resize(unique(st.begin() , st.end()) - st.begin());
   int mn = mod , ans = -1;
   for(int i = 0 ; i < st.size() ; i++){
      if(st[i] >= m / 2)
         break;
      int x = get(st[i]) + get((st[i] + m / 2) % m);
      if(x < mn){
         mn = x;
         ans = st[i];
      }
   }
   int ret = (ans + k) % m;
   if(ret >= m / 2)
      ret -= m / 2;
   cout << mn << " " << ret << "\n";
   for(int i = 0 ; i < n ; i++)
      if(bad(ans , mi[i]))
         cout << i + 1 << " ";
   return 0;
}


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

typedef long long ll;
typedef pair <int , int> pii;
typedef long double ld;

const int N = 2e5+10 , mod = 1e9+7;

unordered_map <int , int> mp;
int mi[N];
int n , h , m , k;

inline bool ch(int time , int check){
   if((check > time && check - time < k) || (check < time && time + k >= m && (time + k) % m > check))
      return true;
   return false;
}

inline bool bad(int time , int check){
   return (ch(time , check) | ch((time + m / 2) % m , check));
}

unordered_map <int , int> fen;

inline void add(int x){
   x++;
   for( ; x < mod ; x += x & -x)
      fen[x]++;
}

inline int ask(int x){
   x++;
   int ret = 0;
   for( ; x ; x -= x & -x)
      ret += fen[x];
   return ret;
}

inline int get(int time){
   int num = 0;
   if(time + k >= m){
      num = ask(m - 1) - ask(time);
      int nw = (time + k) % m;
      num += ask(nw);
      num -= mp[nw];
   }
   else{
      num = ask(time + k) - ask(time);
      num -= mp[time + k];
   }
   return num;
}

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   cin >> n >> h >> m >> k;
   vector <int> st;
   for(int i = 0 ; i < n ; i++){
      int h;
      cin >> h >> mi[i];
      add(mi[i]);
      if(mi[i] >= m / 2)
         st.push_back(mi[i] - m / 2);
      else
         st.push_back(mi[i]);
      if((mi[i] - k + m) % m >= m / 2)
         st.push_back((mi[i] - k + m) % m - m / 2);
      else
         st.push_back((mi[i] - k + m) % m);
      mp[mi[i]]++;
   }
   sort(st.begin() , st.end());
   st.resize(unique(st.begin() , st.end()) - st.begin());
   int mn = mod , ans = -1;
   for(int i = 0 ; i < st.size() ; i++){
      int x = get(st[i]) + get((st[i] + m / 2) % m);
      if(x < mn){
         mn = x;
         ans = st[i];
      }
   }
   int ret = (ans + k) % m;
   if(ret >= m / 2)
      ret -= m / 2;
   cout << mn << " " << ret << "\n";
   for(int i = 0 ; i < n ; i++)
      if(bad(ans , mi[i]))
         cout << i + 1 << " ";
   return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define per(i,a,b) for (int i = (a); i >= (b); --i)
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(x) (x).begin(), (x).end()
#define debug(...) printf(__VA_ARGS__)
typedef std::numeric_limits<ld> ldbl;
ll binpow(ll a,ll b,ll m){ll res=1;for(b%=m-1,a%=m;b>0;b>>=1,a=a*a%m)if(b&1)res=res*a%m;return res;}
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
int n;
int cv(int x)
{
    if(x==0)
        return n;
    if(x==n+1)
        return 1;
    return x;
}
main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        freopen("error.txt","w",stderr);
    #endif
    //cout.precision(ldbl::max_digits10);
    int h,m,k;
    cin>>n>>h>>m>>k;
    int hr[n+1],mi[n+1];
    rep(i,1,n)
        cin>>hr[i]>>mi[i],mi[i]%=m/2;
    pii temp1[n+1];
    rep(i,1,n)
        temp1[i].first=mi[i],temp1[i].second=i;

    sort(temp1+1,temp1+1+n);
    rep(i,1,n)
        mi[i]=temp1[i].first;
    int ivl=m/2-k;
    int i=1,j=1;
    int maxtt=0;
    int pos=0;
    int finali,finalj;
    for(i=1;i<=n;i++)
    {
        //j=i;
        if(i-1==j || (i==1 && j==n))
            j=i;
        while(((mi[j]-mi[i]+m/2)%(m/2))<=ivl)
        {
            j++;
            if(j>n)
                j-=n;
            if(j==i)
            {
                //u can take all
                cout<<"0 "<<mi[i];
                exit(0);
            }
        }
        j--;
        if(j==0)
            j+=n;

        if(j>=i)
        {
            //maxtt=max(maxtt,(j-i+1));
            if(j-i+1>maxtt)
                maxtt=j-i+1,pos=mi[i],finali=i,finalj=j;
        }

        else
        {
            //maxtt=max(maxtt,(j+n-i+1));
            if(j+n-i+1>maxtt)
                maxtt=j+n-i+1,pos=mi[i],finali=i,finalj=j;
        }
    }
    cout<<n-maxtt<<" "<<pos<<endl;
    if(n-maxtt==0)
        exit(0);
    for(int temp=cv(finalj+1);temp!=finali;)
    {
        cout<<temp1[temp].second<<" ";
        temp++;if(temp>n)temp-=n;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define per(i,a,b) for (int i = (a); i >= (b); --i)
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(x) (x).begin(), (x).end()
#define debug(...) printf(__VA_ARGS__)
typedef std::numeric_limits<ld> ldbl;
ll binpow(ll a,ll b,ll m){ll res=1;for(b%=m-1,a%=m;b>0;b>>=1,a=a*a%m)if(b&1)res=res*a%m;return res;}
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        freopen("error.txt","w",stderr);
    #endif
    //cout.precision(ldbl::max_digits10);
    int n,h,m,k;
    cin>>n>>h>>m>>k;
    int hr[n+1],mi[n+1];
    rep(i,1,n)
        cin>>hr[i]>>mi[i],mi[i]%=m/2;

    int ivl=m/2-k;
    int i=1,j=1;
    int maxtt=0;
    int pos=0;
    int finali,finalj;
    for(i=1;i<=n;i++)
    {
        while(((mi[j]-mi[i]+m/2)%(m/2))<=ivl)
        {
            j++;
            if(j>n)
                j-=n;
            if(j==i)
            {
                //u can take all
                cout<<"0 0";return 1;
            }
        }
        j--;
        if(j==0)
            j+=n;
        if(j>=i)
        {
            //maxtt=max(maxtt,(j-i+1));
            if(j-i+1>maxtt)
                maxtt=j-i+1,pos=mi[i],finali=i,finalj=j;
        }

        else
        {
            //maxtt=max(maxtt,(j+n-i+1));
            if(j+n-i+1>maxtt)
                maxtt=j+n-i+1,pos=mi[i],finali=i,finalj=j;
        }
    }
    cout<<n-maxtt<<" "<<pos<<endl;
    for(int temp=finalj+1;temp!=finali;)
    {
        cout<<temp<<" ";
        temp++;if(temp>n)temp-=n;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define per(i,a,b) for (int i = (a); i >= (b); --i)
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(x) (x).begin(), (x).end()
#define debug(...) printf(__VA_ARGS__)
typedef std::numeric_limits<ld> ldbl;
ll binpow(ll a,ll b,ll m){ll res=1;for(b%=m-1,a%=m;b>0;b>>=1,a=a*a%m)if(b&1)res=res*a%m;return res;}
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        freopen("error.txt","w",stderr);
    #endif
    //cout.precision(ldbl::max_digits10);
    int n,h,m,k;
    cin>>n>>h>>m>>k;
    int hr[n+1],mi[n+1];
    rep(i,1,n)
        cin>>hr[i]>>mi[i],mi[i]%=m/2;

    int ivl=m/2-k;
    int i=1,j=1;
    int maxtt=0;
    int pos=0;
    int finali,finalj;
    for(i=1;i<=n;i++)
    {
        while(((mi[j]-mi[i]+m/2)%(m/2))<=ivl)
        {
            j++;
            if(j>n)
                j-=n;
            if(j==i)
            {
                //u can take all
                cout<<"0 0";return 1;
            }
        }
        j--;
        if(j==0)
            j+=n;
        if(j>=i)
        {
            //maxtt=max(maxtt,(j-i+1));
            if(j-i+1>maxtt)
                maxtt=j-i+1,pos=mi[i],finali=i,finalj=j;
        }

        else
        {
            //maxtt=max(maxtt,(j+n-i+1));
            if(j+n-i+1>maxtt)
                maxtt=j+n-i+1,pos=mi[i],finali=i,finalj=j;
        }
    }
    cout<<n-maxtt<<" "<<pos<<endl;
    if(n-maxtt==0)
        exit(0);
    for(int temp=finalj+1;temp!=finali;)
    {
        cout<<temp<<" ";
        temp++;if(temp>n)temp-=n;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define per(i,a,b) for (int i = (a); i >= (b); --i)
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(x) (x).begin(), (x).end()
#define debug(...) printf(__VA_ARGS__)
typedef std::numeric_limits<ld> ldbl;
ll binpow(ll a,ll b,ll m){ll res=1;for(b%=m-1,a%=m;b>0;b>>=1,a=a*a%m)if(b&1)res=res*a%m;return res;}
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        freopen("error.txt","w",stderr);
    #endif
    //cout.precision(ldbl::max_digits10);
    int n,h,m,k;
    cin>>n>>h>>m>>k;
    int hr[n+1],mi[n+1];
    rep(i,1,n)
        cin>>hr[i]>>mi[i],mi[i]%=m/2;

    int ivl=m/2-k;
    int i=1,j=1;
    int maxtt=0;
    int pos=0;
    int finali,finalj;
    for(i=1;i<=n;i++)
    {
        while(((mi[j]-mi[i]+m/2)%(m/2))<=ivl)
        {
            j++;
            if(j>n)
                j-=n;
            if(j==i)
            {
                //u can take all
                cout<<"0 0";exit(0);
            }
        }
        j--;
        if(j==0)
            j+=n;
        if(j>=i)
        {
            //maxtt=max(maxtt,(j-i+1));
            if(j-i+1>maxtt)
                maxtt=j-i+1,pos=mi[i],finali=i,finalj=j;
        }

        else
        {
            //maxtt=max(maxtt,(j+n-i+1));
            if(j+n-i+1>maxtt)
                maxtt=j+n-i+1,pos=mi[i],finali=i,finalj=j;
        }
    }
    cout<<n-maxtt<<" "<<pos<<endl;
    if(n-maxtt==0)
        exit(0);
    for(int temp=finalj+1;temp!=finali;)
    {
        cout<<temp<<" ";
        temp++;if(temp>n)temp-=n;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define per(i,a,b) for (int i = (a); i >= (b); --i)
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(x) (x).begin(), (x).end()
#define debug(...) printf(__VA_ARGS__)
typedef std::numeric_limits<ld> ldbl;
ll binpow(ll a,ll b,ll m){ll res=1;for(b%=m-1,a%=m;b>0;b>>=1,a=a*a%m)if(b&1)res=res*a%m;return res;}
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        freopen("error.txt","w",stderr);
    #endif
    //cout.precision(ldbl::max_digits10);
    int n,h,m,k;
    cin>>n>>h>>m>>k;
    int hr[n+1],mi[n+1];
    rep(i,1,n)
        cin>>hr[i]>>mi[i],mi[i]%=m/2;
    pii temp1[n+1];
    rep(i,1,n)
        temp1[i].first=mi[i],temp1[i].second=i;

    sort(temp1+1,temp1+1+n);
    rep(i,1,n)
        mi[i]=temp1[i].first;
    int ivl=m/2-k;
    int i=1,j=1;
    int maxtt=0;
    int pos=0;
    int finali,finalj;
    for(i=1;i<=n;i++)
    {
        while(((mi[j]-mi[i]+m/2)%(m/2))<=ivl)
        {
            j++;
            if(j>n)
                j-=n;
            if(j==i)
            {
                //u can take all
                cout<<"0 0";exit(0);
            }
        }
        j--;
        if(j==0)
            j+=n;
        if(j>=i)
        {
            //maxtt=max(maxtt,(j-i+1));
            if(j-i+1>maxtt)
                maxtt=j-i+1,pos=mi[i],finali=i,finalj=j;
        }

        else
        {
            //maxtt=max(maxtt,(j+n-i+1));
            if(j+n-i+1>maxtt)
                maxtt=j+n-i+1,pos=mi[i],finali=i,finalj=j;
        }
    }
    cout<<n-maxtt<<" "<<pos<<endl;
    if(n-maxtt==0)
        exit(0);
    for(int temp=finalj+1;temp!=finali;)
    {
        cout<<temp1[temp].second<<" ";
        temp++;if(temp>n)temp-=n;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define per(i,a,b) for (int i = (a); i >= (b); --i)
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(x) (x).begin(), (x).end()
#define debug(...) printf(__VA_ARGS__)
typedef std::numeric_limits<ld> ldbl;
ll binpow(ll a,ll b,ll m){ll res=1;for(b%=m-1,a%=m;b>0;b>>=1,a=a*a%m)if(b&1)res=res*a%m;return res;}
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        freopen("error.txt","w",stderr);
    #endif
    //cout.precision(ldbl::max_digits10);
    int n,h,m,k;
    cin>>n>>h>>m>>k;
    int hr[n+1],mi[n+1];
    rep(i,1,n)
        cin>>hr[i]>>mi[i],mi[i]%=m/2;
    pii temp1[n+1];
    rep(i,1,n)
        temp1[i].first=mi[i],temp1[i].second=i;

    sort(temp1+1,temp1+1+n);
    rep(i,1,n)
        mi[i]=temp1[i].first;
    int ivl=m/2-k;
    int i=1,j=1;
    int maxtt=0;
    int pos=0;
    int finali,finalj;
    for(i=1;i<=n;i++)
    {
        while(((mi[j]-mi[i]+m/2)%(m/2))<=ivl)
        {
            j++;
            if(j>n)
                j-=n;
            if(j==i)
            {
                //u can take all
                cout<<"0 "<<mi[i];exit(0);
            }
        }
        j--;
        if(j==0)
            j+=n;
        if(j>=i)
        {
            //maxtt=max(maxtt,(j-i+1));
            if(j-i+1>maxtt)
                maxtt=j-i+1,pos=mi[i],finali=i,finalj=j;
        }

        else
        {
            //maxtt=max(maxtt,(j+n-i+1));
            if(j+n-i+1>maxtt)
                maxtt=j+n-i+1,pos=mi[i],finali=i,finalj=j;
        }
    }
    cout<<n-maxtt<<" "<<pos<<endl;
    if(n-maxtt==0)
        exit(0);
    for(int temp=finalj+1;temp!=finali;)
    {
        cout<<temp1[temp].second<<" ";
        temp++;if(temp>n)temp-=n;
    }
}


#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 % (m/2);
        }
    }
    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;
}


#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.lower_bound((j + m/2)%m) == s.end()) {
            sk += n;
        } else {
            sk += ft.query(x[*s.lower_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 % (m/2);
        }
    }
    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;
}


#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(s.size() + 1);

    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.lower_bound(j-k) != s.end()) {
                if (*s.lower_bound(j-k) == j-k) {
                    sk -= ft.query(x[*s.lower_bound(j-k)]+1);
                } else {
                    sk -= ft.query(x[*s.lower_bound(j-k)]);
                }
            }
        } else {
            if (s.lower_bound(j-k+m) != s.end()) {
                sk += ft.query(kk);
                if (*s.lower_bound(j-k+m) == j-k+m) {
                    sk -= ft.query(x[*s.lower_bound(j-k+m)]+1);
                } else {
                    sk -= ft.query(x[*s.lower_bound(j-k+m)]);
                }
            }
        }

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

        if (s.lower_bound((j + m/2)%m) == s.end()) {
            sk += ft.query(kk);
        } else {
            sk += ft.query(x[*s.lower_bound((j + m/2)%m)]);
        }
        if ((j + m/2)%m - k >= 0) {
            if (s.lower_bound((j + m/2)%m-k) != s.end()) {
                if (*s.lower_bound((j + m/2)%m-k) == (j + m/2)%m - k) {
                    sk -= ft.query(x[*s.lower_bound((j + m/2)%m-k)]+1);
                } else {
                    sk -= ft.query(x[*s.lower_bound((j + m/2)%m-k)]);
                }
            } else {
                sk -= ft.query(kk);
            }
        } else {
            if (s.lower_bound((j + m/2)%m-k+m) != s.end()) {
                sk += ft.query(kk);
                sk -= ft.query(x[*s.lower_bound((j + m/2)%m-k+m)]);
                if (*s.lower_bound((j + m/2)%m-k+m) == (j + m/2)%m-k+m) {
                    sk -= ft.query(x[*s.lower_bound((j + m/2)%m-k+m)]+1);
                } else {
                    sk -= ft.query(x[*s.lower_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;
}


#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.lower_bound(j-k) != s.end()) {
                if (*s.lower_bound(j-k) == j-k) {
                    sk -= ft.query(x[*s.lower_bound(j-k)]+1);
                } else {
                    sk -= ft.query(x[*s.lower_bound(j-k)]);
                }
            }
        } else {
            if (s.lower_bound(j-k+m) != s.end()) {
                sk += n;
                if (*s.lower_bound(j-k+m) == j-k+m) {
                    sk -= ft.query(x[*s.lower_bound(j-k+m)]+1);
                } else {
                    sk -= ft.query(x[*s.lower_bound(j-k+m)]);
                }
            }
        }

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

        if (s.lower_bound((j + m/2)%m) == s.end()) {
            sk += n;
        } else {
            sk += ft.query(x[*s.lower_bound((j + m/2)%m)]);
        }
        if ((j + m/2)%m - k >= 0) {
            if (s.lower_bound((j + m/2)%m-k) != s.end()) {
                if (*s.lower_bound((j + m/2)%m-k) == (j + m/2)%m - k) {
                    sk -= ft.query(x[*s.lower_bound((j + m/2)%m-k)]+1);
                } else {
                    sk -= ft.query(x[*s.lower_bound((j + m/2)%m-k)]);
                }
            } else {
                sk -= n;
            }
        } else {
            if (s.lower_bound((j + m/2)%m-k+m) != s.end()) {
                sk += n;
                sk -= ft.query(x[*s.lower_bound((j + m/2)%m-k+m)]);
                if (*s.lower_bound((j + m/2)%m-k+m) == (j + m/2)%m-k+m) {
                    sk -= ft.query(x[*s.lower_bound((j + m/2)%m-k+m)]+1);
                } else {
                    sk -= ft.query(x[*s.lower_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;
}