## main

n, t, s = gets.strip.split(' ').map{|s0| s0.to_i}

ms = (t + 1).times.map{0}

n.times do
  #p ms
  ms0 = ms
  ms = []

  ai, bi = gets.strip.split(' ').map{|s0| s0.to_i}

  for i in (0..t)
    if i < bi || (i - bi < s && s < i)
      ms[i] = ms0[i]
    else
      ms[i] = [ms0[i], ms0[i - bi] + ai].max
    end
  end
end
#p ms

puts ms.max