import sys,random,bisect from collections import deque,defaultdict import heapq from itertools import permutations from math import gcd input = lambda :sys.stdin.readline().rstrip() mi = lambda :map(int,input().split()) li = lambda :list(mi()) INF = 10**17 N,V,C = mi() dp = [-INF] * (V+1) dp[0] = 0 for _ in range(N): v,w = mi() ndp = [-INF] * (V+1) for i in range(V+1-v): ndp[i+v] = dp[i]+C+w for i in range(V+1): ndp[i] = max(dp[i],ndp[i]) if v <= i: ndp[i] = max(ndp[i],ndp[i-v]+w) dp = ndp print(max(dp))