#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(void){
    int n,q,b[100000],i,j,flag=0,min,max,meet[50000],count,person,now=0;
    long long int t,a[100000],tmp,point[50000];
    scanf("%d%lld%d",&n,&t,&q);
    for(i=0; i<n; i++){
        scanf("%lld%d",&a[i],&b[i]);
        if(flag==0){
            if(b[i]==1){
                flag=1;
                count=0;
                meet[count]=i;
            }
        }else{
            if(b[i-1]==1 && b[i]==2){
                point[count]=(a[i-1]+a[i])/2;
            }else if(b[i-1]==2 && b[i]==1){
                count++;
                meet[count]=i;
            }
            if(b[i]==2 && i==n-1){
                count++;
                meet[count]=n;
            }
        }
    }
    for(i=0; i<q; i++){
        scanf("%d",&person);
        flag=0;
        person--;
        for(j=now; j<count; j++){
            if(person<meet[0]){
                tmp=a[person]-t;
                printf("%lld\n",tmp);
                now = j;
                flag=1;
                break;
            }else if(person>=meet[j] && person<meet[j+1]){
                if(llabs(point[j]-a[person]) > t){
                    tmp=(b[person]==1)?(a[person]+t):(a[person]-t);
                }else{
                    tmp=point[j];
                }
                printf("%lld\n",tmp);
                now = j;
                flag = 1;
                break;
            }
        }
        if(flag==0){
            tmp=a[person]+t;
            printf("%lld\n",tmp);
        }
    }
    return 0;
}
