#include using namespace std; using ll = long long; #define rep(i,n) for (int i = 0; i < n; i++) #define rrep(i,n) for (int i = n-1; i >= 0; i--) #define rep2(i,a,b) for (int i = a; i < b; i++) #define rrep2(i,a,b) for (int i = a-1; i >= b; i--) #define rep3(i,a,b,c) for (int i = a; i < b; i+=c) #define rrep3(i,a,b,c) for (int i = a-1; i >= b; i-=c) #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() template bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;} template bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;} ll n,v,c; ll dp[5010][5010]; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cin>>n>>v>>c; rep(i,5010)rep(j,5010)dp[i][j]=-1LL<<60; dp[0][0]=0; rep(i,n){ ll u,w;cin>>u>>w; rep(j,v+1){ chmax(dp[i+1][j],dp[i][j]); if((v-j)/u!=0&&j+((v-j)/u)*u<=v)chmax(dp[i+1][j+((v-j)/u)*u],dp[i][j]+c+w*((v-j)/u)); if(j+u<=v)chmax(dp[i+1][j+u],dp[i][j]+c+w); } } ll ans=0; rep(i,v+1)chmax(ans,dp[n][i]); cout<