N,V,C = map(int,input().split()) vs = [] #値段 ws = [] #価値 for i in range(N): v,w = map(int,input().split()) vs.append(v) ws.append(w) dp = [] #購入したものの価値総計 for i in range(N+1): dp.append([-1]*(V+1)) dp[0][0] = 0 for i in range(N): for ii in range(V,-1,-1): if dp[i][ii] != -1: dp[i+1][ii] = max(dp[i][ii],dp[i+1][ii]) tmp = (V-ii)//vs[i] #買える個数 for iii in range(tmp,0,-1): tmp2 = ii+(iii*vs[i]) dp[i+1][tmp2] = max(dp[i+1][tmp2],dp[i][ii]+(ws[i]*iii+C)) ans = 0 for i in dp[-1]: ans = max(ans,i) print(ans)