求调
#include <bits/stdc++.h>
using namespace std;
long long n, s, a, b, x[1001], y[1001], sg, n1[1001], m = 99999999999, c;
int main() {
cin >> n >> s >> a >> b;
sg = a + b;
for (int i = 1; i <= n; i++) {
cin >> x[i] >> y[i];
if (x[i] < sg) {
n1[i] = y[i];
}
}
for (int j = 1; j <= n; j++) {
for (int i = 1; i <= n; i++) {
if (n1[i] < m && s > n1[i]) {
m = n1[i];
s = s - n1[i];
c++;
n1[i] = 1000000000009;
m = 99999999999;
}
}
}
cout << c;
return 0;
}