#include #include #include using namespace std; typedef long long ll; int main(){ ll N, K, L, P; cin >> N >> K >> L >> P; vector A(N); vector B(N); for (ll i = 0; i < N; i++){ cin >> A[i] >> B[i]; } ll ans = 0; for (ll i = 0; i < (1LL << N); i++){ ll popcnt = 0; ll a = 0; ll b = 0; for (ll j = 0; j < N; j++){ if ((i >> j) & 1){ popcnt++; a += A[j]; b += B[j]; } } if (popcnt > K) continue; if (a <= L && b >= P) ans++; } cout << ans << endl; }