n, V, c = map(int, input().split()) dp = [n * c] * (V + 1) for _ in range(n): v, w = map(int, input().split()) ndp = [0] * (V + 1) for i in range(V + 1): ndp[i] = dp[i] - c if i >= v: ndp[i] = max(ndp[i], dp[i - v] + w, ndp[i - v] + w) dp = ndp print(dp[-1])