#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N=1000010;
int v[N];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch<'0'||ch>'9') ch=='-'?o=-1:0,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return o*x;
}
int main() {
    int n,q,tp=0,la=0,pre;
    cin>>n,pre=gi()-gi();
    for(int i=3;i<n;i++) {
	int x=gi();
	for(int j=1;j<=x;j++) {
	    if(la-j<=0) v[++tp]=j-la;
	    else v[++tp]=v[la-j];
	}
	la+=x;
    }
    cin>>q;
    while(q--) {
	int x=gi()-la;
	if(x<-la) x=-la*2-x;
	printf("%d\n",(x>=0?x:v[-x])+pre);
    }
    return 0;
}