import sys input = sys.stdin.readline N,V,C=map(int,input().split()) AB=[tuple(map(int,input().split())) for i in range(N)] DP=[0]*(V+1) for a,b in AB: for i in range(V,-1,-1): if i>=a: DP[i]=max(DP[i],DP[i-a]+b+C) for i in range(V+1): if i>=a: DP[i]=max(DP[i],DP[i-a]+b) print(max(DP))