#include <iostream>

constexpr int MAX_N = (int)1e5, MAX_Q = (int)1e3;

using ll = long long int;

int n, q;
ll t;
ll a[MAX_N], d[MAX_N];

int find_l(int first, int last) {
	for (int i = first; i >= last; --i) {
		if (d[i] == 1)
			return i;
	}
	return -1;
}

int find_r(int first, int last) {
	for (int i = first; i <= last; ++i) {
		if (d[i] == 2)
			return i;
	}
	return -1;
}

int main() {
	std::cin >> n >> t >> q;
	for (int i = 0; i < n; ++i)
		std::cin >> a[i] >> d[i];
	int x;
	for (int i = 0; i < q; ++i) {
		std::cin >> x;
		--x;
		ll ans;
		if (d[x] == 2) {
			if (x == 0)
				ans = a[x] - t;
			else {
				int res = find_l(x - 1, 0);
				if (res == -1)
					ans = a[x] - t;
				else {
					ans = (a[res + 1] + a[res]) / 2;
					if (a[x] - ans > t)
						ans = a[x] - t;
				}
			}
		}
		else {
			if (x == n - 1)
				ans = a[x] + t;
			else {
				int res = find_r(x + 1, n - 1);
				if (res == -1)
					ans = a[x] + t;
				else {
					ans = (a[res] + a[res - 1]) / 2;
					if (ans - a[x] > t)
						ans = a[x] + t;
				}
			}
		}
		std::cout << ans << std::endl;
	}
	return 0;
}