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