N, V, C = map(int, input().split()) VW = [list(map(int, input().split())) for _ in range(N)] # dp[v][k]:=v円かけて最大の満足度k: 0 その品物は買ったことがない 1: 2個目以上 # dp[i+v][1] = max(dp[i+v][1],dp[i][1]+w,dp[i][0]+C+w) # 全部回ったら dp[i][0] = max(dp[i][0],dp[i][1]) # dp[i][1] = 0 dp = [[0, 0] for _ in range(V + 1)] for v, w in VW: for i in range(V): if i + v <= V: dp[i + v][1] = max(dp[i + v][1], dp[i][1] + w, dp[i][0] + C + w) for i in range(V + 1): dp[i][0] = max(dp[i][0], dp[i][1]) dp[i][1] = 0 ans = 0 for i in range(V + 1): ans = max(ans, dp[i][0]) print(ans)