n, t, q = gets.split.map(&:to_i)
stop = []
a = []
n.times do |i|
    x, d = gets.split.map(&:to_i)
    if d == 1
        a << x
    else
        if a.empty?
            stop << [(stop[-1] || -Float::INFINITY), x - t].max
        else
            y = a.pop
            c = (y + x) / 2
            s2 = [c, x - t].max
            s1 = [c, y + t].min
            b = [s1, s2]
            until a.empty?
                y = a.pop
                b.unshift [y + t, b[0]].min
            end
            stop += b
        end
    end
end
stop += a.map {|x| x + t}
q.times do
    p stop[gets.to_i - 1]
end
