#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  ll N, T, Q; cin >> N >> T >> Q;
  ll A[N], D[N]; FOR(i,0,N) cin >> A[i] >> D[i];
  ll X[Q]; FOR(i,0,Q) cin >> X[i];
  vector<ll> stop;
  stop.push_back(-(1LL<<62));
  FOR(i,0,N-1) {
    if(D[i] == 1 && D[i+1] == 2) {
      stop.push_back((A[i]+A[i+1])/2);
    }
  }
  stop.push_back(1LL<<62);
  sort(stop.begin(), stop.end());
  FOR(i,0,Q) {
    ll a = A[X[i] - 1];
    int j = lower_bound(stop.begin(), stop.end(), a) - stop.begin();
    if(D[X[i]-1] == 1) {
      cout << min(stop[j], a + T) << endl;
    } else {
      j--;
      cout << max(stop[j], a - T) << endl;
    }
  }
  return 0;
}