#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef double db;
#define ls(x) ((x)<<1)
#define rs(x) ((x)<<1|1)
#define low(x) ((x)&-(x))
#define all(x) x.begin(),x.end()
#define mp make_pair
#define X first
#define Y second
#ifdef _DEBUG
    const int N=1e2+10;
#else
    const int N=1e2+10;
#endif
const ll mod=1e9+7;
//const ll mod=998244353;
inline ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
inline ll q_pow(ll a,ll x){ll ans=1,tmp=a;while(x){if(x&1)(ans*=tmp)%=mod;(tmp*=tmp)%=mod;x>>=1;}return ans;}
template<typename T> inline void re(T &N){int f=1;char c;while((c=getchar())< '0'||c> '9')if(c=='-')f=-1;N=c-'0';while((c=getchar())>='0'&&c<='9')N=N*10+c-'0';N*=f;}
int m,n,t=1,st,en;
int c[N],b[N];
ll dp[N][N*N];
map<int,ll>ans;
inline ll val(int i,int l,int r)
{
    if(l<=0)return dp[i][r];
    else return (dp[i][r]-dp[i][l-1]+mod)%mod;
}
int main()
{
    #ifdef _DEBUG
        freopen("data.txt","r",stdin);
    #endif
    re(n);
    for(int i=1;i<=n;i++)re(c[i]);
    for(int i=2;i<=n;i++)re(b[i]);
    for(int i=1;i<=n;i++)b[i]+=b[i-1];
    for(int i=1;i<=n;i++)b[i]+=b[i-1];
    int M=*max_element(c+1,c+n+1);
    int l,r;
    r=M-(b[n]/n+(b[n]%n> 0));
    l=r-M;r++;
    for(int m=l;m<=r;m++)
    {
        memset(dp,0,sizeof(dp));
        for(int i=0;i<=n*M;i++)dp[0][i]=1;
        for(int i=1;i<=n;i++)
        {
            for(int j=0;j<=n*M;j++)
                if(j>=i*m+b[i])dp[i][j]=val(i-1,j-c[i],j);
            for(int j=1;j<=n*M;j++)
                (dp[i][j]+=dp[i][j-1])%=mod;
        }
        ans[m]=dp[n][n*M];
    }
    re(m);
    while(m--)
    {
        int x;re(x);
        x=max(x,l);
        x=min(x,r);
        printf("%lld\n",ans[x]);
    }
}
