#include<bits/stdc++.h>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(register int i=(a);i>=(b);--i)
#define int long long
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}

#define mod 1000000007
struct modint{
    int x;
    modint(int o=0){x=o;}
    modint &operator = (int o){return x=o,*this;}
    modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
    modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
    modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
    modint &operator ^=(int b){
        modint a=*this,c=1;
        for(;b;b>>=1,a*=a)if(b&1)c*=a;
        return x=c.x,*this;
    }
    modint &operator /=(modint o){return *this *=o^=mod-2;}
    modint &operator +=(int o){return x=x+o>=mod?x+o-mod:x+o,*this;}
    modint &operator -=(int o){return x=x-o<0?x-o+mod:x-o,*this;}
    modint &operator *=(int o){return x=1ll*x*o%mod,*this;}
    modint &operator /=(int o){return *this *= ((modint(o))^=mod-2);}
    template<class I>friend modint operator +(modint a,I b){return a+=b;}
    template<class I>friend modint operator -(modint a,I b){return a-=b;}
    template<class I>friend modint operator *(modint a,I b){return a*=b;}
    template<class I>friend modint operator /(modint a,I b){return a/=b;}
    friend modint operator ^(modint a,int b){return a^=b;}
    friend bool operator ==(modint a,int b){return a.x==b;}
    friend bool operator !=(modint a,int b){return a.x!=b;}
    bool operator ! () {return !x;}
    modint operator - () {return x?mod-x:0;}
};

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;

#define poly vector<modint>
const modint G=3,Ginv=modint(1)/3;
inline poly one(){poly a;a.push_back(1);return a;}
vector<int>rev;
vector<modint>rts;
inline int ext(int n){
	int k=0;
	while((1<<k)<n)++k;return k; 
}
inline void init(int k){
	int n=1<<k;
	if(rev.size()==n)return;
	rev.resize(n);
	For(i,0,n-1)rev[i]=(rev[i>>1]>>1)|((i&1)<<(k-1));
	if(rts.size()>=n)return;
	int lst=max(1ll,(int)rts.size()); rts.resize(n);
	for(int mid=lst;mid<n;mid<<=1){
		modint wn=G^((mod-1)/(mid<<1));
		rts[mid]=1;
		For(i,1,mid-1)rts[i+mid]=rts[i+mid-1]*wn;
	}
}
void ntt(poly&a,int k,int typ)
{
	int n=1<<k;
	if(typ<0) reverse(a.begin()+1,a.end());
	For(i,0,n-1)if(i<rev[i])swap(a[i],a[rev[i]]); 
	for(int mid=1;mid<n;mid<<=1)
		for(int r=mid<<1,j=0;j<n;j+=r)
			for(int k=0;k<mid;++k){
				modint x=a[j+k],y=rts[mid+k]*a[j+k+mid];
				a[j+k]=x+y,a[j+k+mid]=x-y;
			}
	if(typ<0){
		modint inv=modint(1)/n;
		For(i,0,n-1)a[i]*=inv;
	}
}
 
poly operator +(poly a,poly b){
	int n=max(a.size(),b.size());a.resize(n),b.resize(n);
	For(i,0,n-1)a[i]+=b[i];return a;
}
poly operator -(poly a,poly b){
	int n=max(a.size(),b.size());a.resize(n),b.resize(n);
	For(i,0,n-1)a[i]-=b[i];return a;
}
poly operator *(poly a,modint b){
	int n=a.size();
	For(i,0,n-1)a[i]*=b;return a;
} 
poly operator *(poly a,poly b)
{
	if((int)a.size()<=64 && (int)b.size()<=64){
		poly c(a.size()+b.size()-1,0);
		for(int i=0;i<a.size();++i)
			for(int j=0;j<b.size();++j)
				c[i+j]+=a[i]*b[j];
		return c; 
	}
	int n=(int)a.size()+(int)b.size()-1,k=ext(n);
	a.resize(1<<k),b.resize(1<<k),init(k);
	ntt(a,k,1),ntt(b,k,1);
	For(i,0,(1<<k)-1)a[i]*=b[i];
	ntt(a,k,-1),a.resize(n);return a;
}

#define maxn 200005
#define inf 0x3f3f3f3f
int n,c[maxn],b[maxn];
int bsum=0;
modint f[maxn],g[maxn];
inline modint sumg(int l,int r){
	if(!l)return g[r];
	return g[r]-g[l-1];
}
signed main()
{
	n=read();
	For(i,1,n)c[i]=read();
	For(i,1,n-1)b[i]=read(),bsum+=b[i]*(n-i);
	f[0]=1;
	int all=0;
	For(i,1,n){
		For(j,0,all)g[j]=f[j],f[j]=0;
		all+=c[i];
		For(j,1,all)g[j]+=g[j-1];
		For(j,0,all)
			f[j]=sumg(max(j-c[i],0ll),j);
//		For(j,0,all)cout<<f[j].x<<" ";puts("");
	}
//	For(i,0,all)cout<<f[i].x<<" ";puts("");
	Rep(i,all-1,0) f[i]+=f[i+1]; 
	int Q=read();
	while(Q--){
		int x=read();
		int now=n*x+bsum;
		if(now<0)now=0;
		if(now>all)puts("0");
		else cout<<f[now].x<<endl;
	}
	return 0;
}
/*

*/