#include using namespace std; #include using namespace atcoder; using ll=long long; using Graph=vector>; #define MAX 3000 //#define MOD 1000000007 #define MOD 998244353 #define INF 1000000000 //#define INF 1000000000000000000 int main(){ int N,V,C; cin>>N>>V>>C; vector v(N),w(N); for(int i=0;i>v[i]>>w[i]; } vector dp(V+1,0); for(int i=0;i=0;j--){ dp[j+v[i]]=max(dp[j+v[i]],dp[j]+w[i]+C); } for(int j=0;j<=V-v[i];j++){ dp[j+v[i]]=max(dp[j+v[i]],dp[j]+w[i]); } } cout<