#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cassert>
#define INF 1000000000000000000
#define MOD 1000000007
#define sym cout<<"---------"<<endl;
#define ll long long
#define mk make_pair
#define en endl
#define RE return 0
#define int ll
#define P pair<int,int>
using namespace std;
int dx[5]={1,0,-1,0,0},dy[5]={0,1,0,-1,0};
int gcd(int a,int b){if(a%b==0){return b;}else return gcd(b,a%b);}
int lcm(int a,int b){if(a==0){return b;} return a/gcd(a,b)*b;}

#define MAX 100005
int n,t,q;
struct people{
	int where,dir;
};
people peo[MAX];
bool done[MAX];
int d[MAX];

signed main(){
	cin>>n>>t>>q;
	
	for(int i=1; i<=n; i++){
		int a,b; cin>>a>>b;
		peo[i].where=a; peo[i].dir=b;
		done[i]=false;
	}
	vector<int> col;
	for(int i=1; i<=n-1; i++){
		if(peo[i].dir==1){
			if(peo[i+1].dir==2&&2*t>peo[i+1].where-peo[i].where){
				int c=(peo[i+1].where+peo[i].where)/2;
				col.push_back(c);
				done[i+1]=done[i]=true;
				d[i+1]=d[i]=c;
			}
		}
	}
	sort(col.begin(), col.end());
	for(int i=0; i<q; i++){
		int a; cin>>a;
		if(done[a]){
			cout<<d[a]<<en;
			continue;
		}
		bool ok=false;
		P ans; ans.first=2*INF+1;
		for(int j=0; j<col.size(); j++){
			int w=col[j];
			if(w-peo[a].where>0&&peo[a].dir==1){
				if(w-peo[a].where<t){
					if(ans.first>w-peo[a].where){ 
						ans.second=w;
						ans.first=abs(w-peo[a].where);
					}
					ok=true;
				}
			}else if(w-peo[a].where<0&&peo[a].dir==2){
				if(peo[a].where-w<t){
					if(ans.first>peo[a].where-w){ 
						ans.second=w;
						ans.first=abs(peo[a].where-w);
					}
					ok=true;
				}
			}
		}
		if(!ok) cout<<(peo[a].dir==1 ? peo[a].where+t:peo[a].where-t)<<en;
		else cout<<ans.second<<en;
	}
}


