nkq = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
s = a.uniq
t = a.sort
current_min = t[nkq[2]-1] - t[0]
s.each do |i|
  candidates = []
  head_pointer = a.length
  a.each.with_index do |t, idx|
    if t >= i
      head_pointer = idx if head_pointer == a.length
    elsif head_pointer < idx
      candidates << a[head_pointer..idx-1]
      head_pointer = idx + 1
    end
  end
  candidates << a[head_pointer..-1]
  #p candidates
  new_candidates = []
  candidates.each do |s|
    if s.length >= nkq[1]
      new_candidates << s.sort[0..(s.length - nkq[1] + 1)]
    end
  end
  #p [i, new_candidates.flatten.sort]
  if new_candidates.flatten.length >= nkq[2]
    cd = new_candidates.flatten.sort[nkq[2]-1] - nkq[0]
    current_min = cd if current_min > cd && cd > 0
  end
end

puts current_min