#include<iostream>
using namespace std;
typedef long long ll;
struct person{ll s,e,d;};
int main(){
  ll n,i,j,k,t,q;
  cin >> n >> t >> q;
  person ps[100001];
  ll p1=-1,p2=-1;
  for(i=0;i<n;i++){
    cin >> ps[i].s >> ps[i].d;
    if(ps[i].d==1) p1=i;
    else{
      ps[i].e=ps[i].s-t;
      if(p1==-1){
      }else if(p2!=-1){
        if(ps[p1].s<ps[p2].s) 
          ps[i].e=max(ps[i].e,ps[p2].e);
        else 
          ps[i].e=max(ps[i].e,(ps[i].s+ps[p1].s)/2);
      }else{
        ps[i].e=max(ps[i].e,(ps[i].s+ps[p1].s)/2);
      }
      p2=i;
    }
  }
  p1=-1;p2=-1;
  for(i=n-1;i>=0;i--){
    if(ps[i].d==2) p2=i;
    else{
      ps[i].e=ps[i].s+t;
      if(p2==-1){
      }else if(p1!=-1){
        if(ps[p1].s<ps[p2].s) 
          ps[i].e=min(ps[i].e,ps[p1].e);
        else 
          ps[i].e=min(ps[i].e,(ps[i].s+ps[p2].s)/2);
      }else{
        ps[i].e=min(ps[i].e,(ps[i].s+ps[p2].s)/2);
      }
      p1=i;
    }
  }
  //cout<<endl;
  /*
  for(i=0;i<n;i++){
    cout << ps[i].e << endl;
  }
  cout << endl;
  */
  for(i=0;i<q;i++){
    cin >> k;
    cout << ps[k-1].e << endl;
  }
  return 0;
}