#!/usr/bin/env PyPy3 from collections import Counter, defaultdict, deque import itertools import re import math from functools import reduce import operator import bisect from heapq import * import functools mod=998244353 import sys input=sys.stdin.readline n,V,c=map(int,input().split()) INF = 1 << 31 dp = [-INF] * (V+1) dp[0] = 0 for i in range(n): v,w=map(int,input().split()) for j in range(v,V+1): dp[j] = max(dp[j],dp[j-v]+w) for j in range(v,V+1)[::-1]: dp[j] = max(dp[j],dp[j-v]+w+c) print(max(dp))