#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <stack>
#define ll long long
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	ll N, T, Q; cin >> N >> T >> Q;
	vector <pair<ll, ll>> A(N + 1);
	for (int i = 1; i <= N; i++) {
		cin >> A[i].first >> A[i].second;
		if (A[i].second == 2) A[i].second = -1;
	}
	vector<ll> q(Q);
	for (int i = 0; i < Q;i++) cin >> q[i];


	vector<ll> ans(N + 1);
	int f = 0;
	ll l;
	ll mid;
	for (int i = 1; i <= N;i++) {
		if (f == 0 && A[i].second == -1) {
			ans[i] = A[i].first + A[i].second*T;
			continue;
		}
		if (f == 0 && A[i].second == 1) {
			f = 1; l = i;
			continue;
		}
		if (f == 1 && A[i].second == 1) continue;
		if (f == 1 && A[i].second == -1) {
			mid = (A[i].first + A[i - 1].first) / 2;
			ans[i] = max(mid, A[i].first + A[i].second * T);

			for (int at = l; at < i; at++) {
				ans[at] = min(mid, A[at].first + A[at].second*T);
			}
			f = 2;
			continue;
		}
		if (f == 2 && A[i].second == -1) {
			ans[i] = max(mid, A[i].first + A[i].second*T);
			continue;
		}
		if (f == 2 && A[i].second == 1) {
			f = 1; l = i;
			continue;
		}
	}
	if (f == 1) {
		//ans[N] = A[N].first + A[N].second*T;
		for (int at = l; at <= N; at++) {
			ans[at] = A[at].first + A[at].second*T;
		}
	}

	for (int i = 0; i < Q;i++) {
		cout << ans[q[i]] << endl;
	}
}