#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

struct Data {
  int X, id;
  ll A;
  Data(int id, int X, ll A) : id(id), X(X), A(A){}
};

int main() {
  int N, Q;
  ll T;
  cin >> N >> T >> Q;
  ll A[N];
  int D[N];
  int X[Q];
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> D[i];
  }
  for (int i = 0; i < Q; i++) {
    cin >> X[i];
    X[i]--;
  }
  ll r = 0;
  ll l = 0;
  vector<ll> p;
  vector<Data> dr;
  vector<Data> dl;
  for (int i = 0; i < Q; i++) {
    if (D[X[i]] == 1) {
      dr.push_back(Data(i, X[i], A[X[i]]));
    } else {
      dl.push_back(Data(i, X[i], A[X[i]]));
    }
  }

  for (int i = 0; i < N; i++) {
    if (D[i] == 1) {
      r = A[i];
    } else {
      l = A[i];
    }
    if (r == 0 || l == 0) continue;
    if (abs(l - r) <= 2 * T && r < l) {
      p.push_back((l + r) / 2);
      l = 0;
      r = 0;
    }
  }
  
  int ir = 0;
  // for (ll i : p) {
  //   cout << "p: " << i << "\n";
  // }
  ll t[Q];
  for (int i = 0; i < dr.size(); i++) {
    int X = dr[i].X;
    t[dr[i].id] = A[X] + T;
    // if (X == 17) {
    //   cout << t[dr[i].id] << " ------------- " << p[ir] << "\n"; 
    // }
    while (ir < p.size()) {
      if (p[ir] < A[X]) {
        ir++;
      } else if (A[X] <= p[ir] && p[ir] <= t[dr[i].id]) {
        t[dr[i].id] = p[ir];
        break;
      } else {
        break;
      }
    }
    // if (X == 17) {
    //   cout << t[dr[i].id] << " ------------- " << ir << "\n";
    // }
  }
 

  int il = p.size() - 1;
  for (int i = dl.size() - 1; i >= 0; i--) {
    int X = dl[i].X;
    t[dl[i].id] = A[X] - T;
    while (il >= 0) {
      if (A[X] < p[il]) {
        il--;
      } else if (t[dl[i].id] <= p[il] && p[il] <= A[X]) {
        t[dl[i].id] = p[il];
        break;
      } else {
        break;
      }
    }
  }
  // for (int i = 0; i < p.size(); i++) {
  //   cout << i << " " << p[i] << "\n";
  // }

  for (ll i : t) {
    cout << i << "\n";
  }
  return 0;
}
