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

typedef long long lint;

int N, Q, D[100005];
lint T, A[100005];

void solve(int x) {
	int i = x + D[x];
	while (0 <= i && i < N && D[i] == D[x]) i += D[x];
	lint ans = A[x] + T * D[x];
	if ((D[x] == 1 && i < N) || (D[x] == -1 && 0 <= i)) {
		int li = (D[x] == -1 ? i : i-1), ri = (D[x] == -1 ? i+1 : i);
		lint L = A[li] + T, R = A[ri] - T;
		if (L > R) {
			lint C = A[li] + (A[ri] - A[li]) / 2;
			ans = (D[x] == -1 ? max(ans, C) : min(ans, C));
		}
	}
	cout << ans << endl;
}

int main() {
	cin >> N >> T >> Q;
	for (int i=0; i<N; ++i) {
		cin >> A[i] >> D[i];
		if (D[i] == 2) D[i] = -1;
	}
	
	for (int i=0; i<Q; ++i) {
		int x;
		cin >> x;
		--x;
		solve(x);
	}
}
