#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<math.h>
#include<stdlib.h>
#include <functional>
using namespace std;
struct haha{
int height;
int strength;
}tao[22222];
bool cmp(haha q,haha w)
{
return q.strength<w.strength;
}
int main()
{ int n,s,a,b,t=0;
cin>>n>>s>>a>>b;
int h=a+b;
for(int i=0;i<n;i++)
{
cin>>tao[i].height>>tao[i].strength;
}
sort(tao,tao+n,cmp);
for(int i=0;i<n;i++)
{
if(s>=tao[i].strength&&h>=tao[i].height)
{
t++;
s-=tao[i].strength;
}
}
cout<<t<<endl;
return 0;
}