#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#define int long long
#define mod 5000000007000000000
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
int n, t, q;
int a[123456], d[123456], h[123456];
signed main() {
	cin >> n >> t >> q;
	for1(i, n) { cin >> a[i] >> d[i]; h[i] = (d[i] == 1 ? mod : -mod); }
	for1(i, n - 1) {
		if (d[i] == 1 && d[i + 1] == 2) {
			h[i] = (a[i] + a[i + 1]) / 2;
			h[i + 1] = h[i];
			int j = i - 1;
			while (j && d[j] == 1) { h[j] = h[i]; j--; }
			while (i + 1 <= n && d[i + 1] == 2) { h[i + 1] = h[i]; i++; }
		}
	}
	for1(i, q) {
		int p; cin >> p;
		if (d[p] == 1) cout << min(h[p], a[p] + t);
		else cout << max(h[p], a[p] - t);
		cout << endl;
	}
}
