#include <bits/stdc++.h>

using namespace std;

#define INF (1LL << 62)

struct Human {
	int direct;
	long long position;
	long long save;
} human[100001];

int main() {
	long long t;
	int n, q;

	cin >> n >> t >> q;
	for (int i = 1; i <= n; ++i) {
		cin >> human[i].position >> human[i].direct;
	}
	human[0].direct = 1;
	human[0].position = -INF;
	human[n + 1].direct = 2;
	human[n + 1].position = INF;

	for (int i = 0; i <= n; ++i) {
		if (human[i].direct == 1 && human[i + 1].direct == 2) {
			long long d = (human[i].position + human[i + 1].position) / 2;
			for (int j = i; j >= 1 && human[j].direct == 1; --j) {
				human[j].save = d;
			}
			for (int j = i + 1; j <= n && human[j].direct == 2; ++j) {
				human[j].save = d;
			}
		}
	}

	int id;
	for (int i = 0; i < q; ++i) {
		cin >> id;
		if (human[id].direct == 1) {
			cout << (human[id].position + t < human[id].save ? human[id].position + t : human[id].save) << endl;
		}
		else {
			cout << (human[id].position - t > human[id].save ? human[id].position - t : human[id].save) << endl;
		}
	}

	return 0;
}