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

ll A[100010],res[1010];int D[100010],imp[1010];
int main(){
	ll N,T,Q;
	cin>>N>>T>>Q;
	for(int i=1;i<=N;i++){
		cin>>A[i]>>D[i];
	}
	
	for(int i=1;i<=Q;i++){
		cin>>imp[i];
	}

	vector<ll> vpl;
	for(int i=1;i<N;i++){
		if(D[i]==1&&D[i+1]==2){
			vpl.push_back((A[i]+A[i+1])/2);
		}
	}

	auto it=vpl.begin();
	for(int i=1;i<=Q;i++){
		while(it!=vpl.end()&&(*it)<A[imp[i]]) it++;
		if(D[imp[i]]==2&&it==vpl.begin()){
			res[i]=A[imp[i]]-T;
			continue;
		}
		else if(D[imp[i]]==2) it--;
		if(it==vpl.end()){
			res[i]=A[imp[i]]+T;
			continue;
		}
		if(D[imp[i]]==1){
			res[i]=min(A[imp[i]]+T,*it);
		}
		else{
			res[i]=max(A[imp[i]]-T,*it);
		}
	}
	for(int i=1;i<=Q;i++) cout<<res[i]<<endl;
	return 0;
}