#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,A,B; cin >> N >> A >> B; vector> dp(N+1,vector(A+1,B+1)); dp.at(0).at(0) = 0; for(int t=0; t> x >> y; for(int i=N-1; i>=0; i--) for(int k=0; k<=A-x; k++) dp.at(i+1).at(k+x) = min(dp.at(i+1).at(k+x),dp.at(i).at(k)+y); } int answer = 0; for(int i=1; i<=N; i++) for(auto b : dp.at(i)) if(b <= B) answer = i; cout << answer << endl; }