include[HTML_REMOVED]
using namespace std;
int main(){
int N,V;
cin>>N>>V;
vector[HTML_REMOVED] v(N);
vector[HTML_REMOVED] w(N);
vector[HTML_REMOVED] dp(V+1,0);
for(int i=0;i[HTML_REMOVED]>v[i]>>w[i];
for(int i=0;i[HTML_REMOVED]=0;j–){
if(j>=v[i])dp[j]=max(dp[j-v[i]]+w[i],dp[j]);
}
}
cout<<dp[V];
}