#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

ll a[100001];
int d[100001];
vector<ll> v;
int main(){
    ll n,t,q;
    cin>>n>>t>>q;
    int pre=2;
    v.pb(LLONG_MIN);
    rep(i,n){
        cin>>a[i]>>d[i];
        if(pre==1&&d[i]==2){
            v.pb((a[i-1]+a[i])/2);
        }
        pre=d[i];
    }
    v.pb(LLONG_MAX);
    int x;
    rep(i,q){
        cin>>x;--x;
        if(d[x]==2){
            int cur=lower_bound(v.begin(),v.end(),a[x])-v.begin();
            if(a[x]-t>v[cur-1]) cout<<a[x]-t<<endl;
            else cout<<v[cur-1]<<endl;
        }
        else{
            int cur=upper_bound(v.begin(),v.end(),a[x])-v.begin();
            if(a[x]+t<v[cur]) cout<<a[x]+t<<endl;
            else cout<<v[cur]<<endl;
        }
    }
    return 0;
}
