#include <iostream>
#include <vector>
#include <algorithm>

constexpr int MAX_N = 100000;
constexpr long long MAX_T = 1000000000000000000;

long long N, T, Q;

long long pos[MAX_N], target[MAX_N];
int dir[MAX_N];
std::vector<long long> stops;

void solve();

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);

	std::cin >> N >> T >> Q;

	for(int i = 0; i < N; ++i){
		std::cin >> pos[i] >> dir[i];
	}

	for(int i = 0; i < N - 1; ++i){
		if(dir[i] == 1 && dir[i + 1] == 2 && (pos[i + 1] - pos[i]) <= (T * 2)){
			stops.push_back((pos[i + 1] + pos[i]) / 2);
		}
	}

	for(int i = 0; i < Q; ++i){
		int input;
		std::cin >> input;
		--input;

		long long res = MAX_T;
		if(dir[input] == 1){ //When a citizen heads east.
			auto itr = std::lower_bound(stops.begin(), stops.end(), pos[input]);
			if(itr != stops.end() && *itr <= pos[input] + T){
				res = *itr;
			}
		}
		else{ //When a citizen heade west.
			auto itr = std::lower_bound(stops.begin(), stops.end(), pos[input] - T);
			while(itr != stops.end() && *itr <= pos[input]){
				res = *itr;
				++itr;
			}
		}

		if(res == MAX_T){
			if(dir[input] == 1){
				std::cout << pos[input] + T << std::endl;
			}
			else{
				std::cout << pos[input] - T << std::endl;
			}
		}
		else{
			std::cout << res <<  std::endl;
		}
	}

	return 0;
}

