#include <bits/stdc++.h>
using namespace std;

long long N,T,Q;
long long A[100001],D[100001];
long long X[10001];
vector<long long> stp;

int main(){
	scanf("%lld%lld%lld",&N,&T,&Q);
	for(int i = 0; i < N; i++){
		scanf("%lld%lld",&A[i],&D[i]);
	}
	for(int i = 0; i < Q; i++){
		scanf("%lld",&X[i]);
		X[i]--;
	}
	stp = vector<long long>();
	for(int i = 0;i < N-1; i++){
		if(D[i] == 1 && D[i+1] == 2){
			stp.push_back((A[i] + A[i+1])/2);
		}
	}


	for(int i = 0; i < Q; i++){
		if(stp.size() == 0){
			printf("%lld\n",D[X[i]] == 1 ? A[X[i]]+T : A[X[i]]-T);
		}
		else if(D[X[i]] == 2 && A[X[i]] < stp[0]){
			printf("%lld\n",D[X[i]] == 1 ? A[X[i]]+T : A[X[i]]-T);
		}
		else if (D[X[i]] == 1 && A[X[i]] > stp[stp.size()-1]){
			printf("%lld\n",D[X[i]] == 1 ? A[X[i]]+T : A[X[i]]-T);
		}
		else{
			vector<long long>::iterator itr = lower_bound(stp.begin(),stp.end(),A[X[i]]);	
			int east = distance(stp.begin(),itr);
			int west = east-1;
			if(D[X[i]] == 1){ // east
				printf("%lld\n",min(stp[east],A[X[i]]+T));
			}
			else{ // west
				printf("%lld\n",max(stp[west],A[X[i]]-T));
			}
		}
	}

	return 0;
}

