N,V,C = map(int,input().split()) from collections import defaultdict d = defaultdict(int) for _ in range(N): v,w = map(int,input().split()) d[v] = max(d[v],w) dp = [0] * (V + 1) for v,w in d.items(): nx = dp.copy() for i in range(V + 1): for j in range(1,(V - i) // v + 1): nx[i + j * v] = max(nx[i + j * v],dp[i] + C + w * j) dp = nx print(max(dp))