#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const int inf=1<<30; const ll INF=1LL<<62; typedef pair P; typedef pair PP; const ll MOD=998244353; int main(){ int N; ll M,Q; cin>>N>>M>>Q; vector A(N),B(N); for(int i=0;i>A[i]>>B[i]; vector dpA(1<>i)&1){ totalA+=A[i]; totalB+=B[i]; } } if(totalA<=M){ dpA[S]=totalB; } } for(int S=0;S<(1<>i)&1){ totalA+=A[i]; totalB+=B[i]; } } if(totalA<=Q){ dpB[S]=totalB; } } //Aの高速ゼータ変換 for(int S=0;S<(1<