#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
#define N 105
#define ll long long
#define in(l,n)  for(int i=l;i<=n;i++)
int n,q,a[N],b[N],c[N];
ll sumb[N];
ll dp[N][N*N];
map<int,ll> res;
const int mod=1e9+7;
int main(){
    scanf("%d",&n);
    in(1,n)   scanf("%d",c+i);
    in(2,n)  {
        scanf("%d",b+i);
        b[i]=b[i]+b[i-1];
        sumb[i]=sumb[i-1]+b[i];
    }
    scanf("%d",&q);
    int M=*max_element(c+1,c+n+1);
    int l=-sumb[n]/n-(sumb[n]%n>0?1:0);
    int r=M+l+1;
    for(int m=l;m<=r;m++){
        memset(dp,0,sizeof(dp));
        in(0,n*M) dp[0][i]=1;
        in(1,n){
            for(int j=0;j<=n*M;j++){
                if(j<i*m+sumb[i])
                    continue;
                dp[i][j]=dp[i-1][j];
                if(j>c[i])
                    dp[i][j]-=dp[i-1][j-c[i]-1];
                dp[i][j]+=mod;
                dp[i][j]%=mod;
            }
            for(int j=1;j<=n*M;j++){
                dp[i][j]+=dp[i][j-1];
                dp[i][j]%=mod;
            }
        }
        dp[n][n*M]+=mod;
        res[m]=dp[n][n*M]%mod;
    }
    int t;
    in(1,q)   {
        scanf("%d",&t);
        t=min(t,r);
        t=max(t,l);
        printf("%lld\n",res[t]);
    }
}