N, V, C = map(int,input().split()) dp = [[0] * (N+1)] * (V+1) for x in range(N): v, w = int(input()) if v > V: continue for y in range(v, V+1): dp[y][x+1] = max(dp[y][x], dp[y-v][x] + w+c) print(dp[-1][-1])