#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int cl(int a, int b) {
	return (a - (a%b)) / b;//b=0だと積む
}
int up(int a, int b) {
	return cl(a + b - 1, b);//b=0だと積む
}
int ord(int a, int p) {
	if (a%p == 0) {
		return ord(a / p, p) + 1;
	}
	else {
		return 0;
	}
}
long long ruin(int a, int n, long long  p) {
	if (n == 0) {
		return (1%p);
	}
	else {
	long long x = ruin(a, (n - (n % 2)) / 2, p);
		if (n % 2 == 0) {
			return (x*x) % p;
		}
		else {
			return (((x*x) % p)*a) % p;
			
		}
	
	}
	
}
long long com(int n, int r, int p) {
	if (r == 0) {
		return (1%p);
	}
	else {
		long long x = com(n, r - 1, p);
		return (x*(n - r) / r) % p;
	}
}
int main()
{
	int n, q; long long t;
	cin >> n >> t >> q;
	vector<long long> a(n);
	vector<int> d(n);
	vector<int> e(q);
	vector<long long>ans(q);
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> d[i];
	}
	for (int i = 0; i < q; i++) {
		int x;
		cin >> x;
		e[i] = x - 1;
	}
	int ba = 2;
	vector<int> nu(n);
	vector<int> ch(n);
	int si = 0;
	int no = -1;//kesu
	for (int i = 0; i < n; i++)
	{
		if (d[i] != ba) {
			ch[si] = i;
			si++;
			no++;
			ba = d[i];
		}
		nu[i] = no;
	}
	for (int i = 0; i < q; i++) {
		int p = e[i];
		int x = nu[p];
		int y = x + (1 - ((x+2) % 2));
		if (y < 0) {
			cout << a[p] - t << endl;
		}
		else if (y >= si) {
			cout << a[p] + t << endl;
		}
		else {
			long long me = (a[ch[y]] + a[ch[y] - 1]) / 2;
			if (d[p] == 1) {
				cout << min(a[p] + t, me) << endl;
			}
			else {
				cout << max(a[p] - t, me) << endl;
			}
		}
	}
}

