#include<iostream>
#include<algorithm>
using namespace std;
class people{
public:
    long long int place;
    int dotti;
};
int main(){
    int n;
    long long int T;
    int Q;
    cin>>n>>T>>Q;
    people *house;
    house=new people[n+2];
    for(int i=1;i<=n;++i){
        cin>>house[i].place>>house[i].dotti;
    }
    long long int dummy;
    house[0].dotti=2;
    house[n+1].dotti=1;
    for(int i=1;i+1<=n;++i){
        if(house[i].dotti==1&&house[i+1].dotti==2){
        if(house[i+1].place-house[i].place<=2*T){
            dummy=(house[i].place+house[i+1].place)/2;
            house[i].place=dummy;
            house[i+1].place=dummy;
            for(int j=i-1;j>=1;--j){
                if(house[j+1].place-house[j].place<=T&&house[j].dotti==1){
                    house[j].place=house[j+1].place;
                    house[j].dotti=3;
                }else{
                    break;
                }
            }
            for(int j=i+2;j<=n;++j){
                if(house[j].place-house[j-1].place<=T&&house[j].dotti==2){
                    house[j].place=house[j-1].place;
                    house[j].dotti=3;
                }else{
                    break;
                }
            }
        }else{
            house[i].place+=T;
            house[i+1].place-=T;
        }
        house[i].dotti=3;
        house[i+1].dotti=3;
        }
    }
    for(int i=1;i<=n;++i){
        if(house[i].dotti==2){
            house[i].place-=T;
        }else if(house[i].dotti==1){
            house[i].place+=T;
        }
    }
    int doll;
    for(int i=0;i<Q;++i){
        cin>>doll;
        cout<<house[doll].place<<endl;
    }
    return 0;
}