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