#include<iostream>
#include<fstream>

using namespace std;
signed long long int a[100000];
signed long long int b[100000];
signed long long int c[100000];
signed long long int d[100000];
signed long long int e[100000];
signed long long int x=0;
signed long long int h[100000];
signed long long int n=0;
signed long long int t=0;
signed long long int q=0;
signed long long int i=0;
signed long long int j=0;
signed long long int k=0;
signed long long int s=0;
signed long long int f=0;
int main(){
	
	for(i=0;i<100000;i++){
		a[i]=0;
		b[i]=0;
		c[i]=0;
		d[i]=0;
		e[i]=0;
		h[i]=0;
	}
	cin>>n;
	cin>>t;
	cin>>q;
	for(i=0;i<n;i++){
		cin>>a[i];
		cin>>b[i];
	}
	for(i=0;i<q;i++){
		cin>>d[i];
	}
	for(i=0;i<n-1;i++){
		if(b[i]==1 && b[i+1]==2){
			f=a[i+1]-a[i];
			f=f/2;
			c[i]=f;
			c[i+1]=f;
			x=f+a[i];
			if(s!=0){
				for(j=0;j<s;j++){
					c[h[j]]=x-a[h[j]];
				}
			}
			s=0;			
		}else if(b[i]==1){
			h[s]=i;
			s++;
		}else if(b[i+1]==2){
			c[i+1]=a[i+1]-x;
			if(c[i+1]<0){
				c[i+1]=0;
			}
		}
	}
	for(i=0;i<q;i++){
		if(c[d[i]-1]==0 || c[d[i]-1]>t){
			if(b[d[i]-1]==1){
				e[i]=a[d[i]-1]+t;
			}else{
				e[i]=a[d[i]-1]-t;
			}
		}else{
			if(b[d[i]-1]==1){
				e[i]=a[d[i]-1]+c[d[i]-1];
			}else{
				e[i]=a[d[i]-1]-c[d[i]-1];
			}
		}
		cout<<e[i]<<endl;
	}
}
	