n, t, s = gets.split.map(&:to_i)
arr = n.times.map{ gets.split.map(&:to_i) }
dp = 2.times.map{ [0]*(t+1) }
ret = 0
n.times do |i|
  (t-arr[i][1]).times do |j|
    if !(j + arr[i][1] > s && s > j)
      dp[1][j + arr[i][1]] = [dp[1][j + arr[i][1]], dp[0][j] + arr[i][0]].max
    end
  end
  ret = [ret, dp[1].max].max
  dp[0] = dp[1].dup
end
p ret 