// нахуй такие задачи пиздец

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m,k,a[15],is[200005];
struct P{
	long double k,x;
}f[200005],sum[200005];//f[i]=k*f[1]+x
P operator +(P i,P j){
	return {i.k+j.k,i.x+j.x};
} 
P operator -(P i,P j){
	return {i.k-j.k,i.x-j.x};
}
P operator /(P i,double j){
	return {i.k/j,i.x/j};
} 
int main(){
	cin>>n>>m>>k;
	for(int i=1;i<=k;i++)cin>>a[i],is[a[i]]=1;
	for(int i=n-1;i>=0;i--){
		if(!is[i])f[i]=(sum[i+1]-sum[i+m+1])/m+(P){0,1};
		else f[i]=(P){1,0};
		sum[i]=sum[i+1]+f[i];
	}
	if(fabs(f[0].k-1)<1e-6)puts("-1");
	else {
		long double x=-f[0].x/(f[0].k-1);
		printf("%.4Lf\n",x);
	}
}
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int N, Q; cin >> N;
    vector<int> A(N), T(N);
    REP(i, 0, N) cin >> A[i] >> T[i];

    cin >> Q;
    vector<ll> X(Q);
    REP(i, 0, Q) cin >> X[i]; 


    set<ll> S;
    REP(i, 0, Q) S.insert(X[i]);

    ll offset = 0;
    REP(i, 0, N) {
        if (T[i] == 1) {
            offset += A[i];
        } else if (T[i] == 2) {
            auto itr = S.lower_bound(A[i] - offset);

            bool deleted = false;
            auto jtr = S.begin();
            while (jtr != itr) {
                jtr = S.erase(jtr);
                deleted = true;
            }
            if (deleted) {
                S.insert(A[i] - offset);
            } 
        } else {
            auto itr = S.lower_bound(A[i] - offset);

            bool deleted = false;
            while (itr != S.end()) {
                itr = S.erase(itr);
                deleted = true;
            }
            if (deleted) {
                S.insert(A[i] - offset);
            } 
        }
    }
    // for (auto x : S) cout << x << " ";
    // cout << endl;

    REP(i, 0, Q) {
        auto itr = S.lower_bound(X[i]);
        if (itr != S.begin() && (itr == S.end() || *itr > X[i])) itr = prev(itr);
        // cout << "# i : " << i << ", X[i] : " << X[i] << ", itr : " << *itr << endl;
        cout << *itr + offset << endl;
    }
    return 0;
}
