#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX - 100
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lower_bound lowb
#define upper_bound upb
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a*b/gcd(a,b);};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};

int N, T, Q;
int a[1000010], d[1000010];
int x[1000010];
int memo[1000010];

signed main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	cin >> N >> T >> Q;
	rep(i, N) cin >> a[i] >> d[i];
	rep(i, Q) cin >> x[i];
	Fill(memo, INF);

	rep(i, N - 1) {
		if(d[i] == 1 && d[i + 1] == 2) {
			int t = (a[i] + a[i + 1]) / 2;

			memo[i] = t;

			for(int j = i - 1; ((d[j] == 1) && (j >= 0)); j--) {
				memo[j] = t;
			}

			for(int j = i + 1; ((d[j] == 2) && (j < N)); j++) {
				memo[j] = t;
			}
		}
	}

	rep(i, Q) {
		int now = x[i] - 1;
		if(abs(a[now] - memo[now]) <= T) cout << memo[now] << endl;
		else if(d[now] == 1) cout << a[now] + T << endl;
		else cout << a[now] - T << endl;
	}
	return 0;
}

