#include <bits/stdc++.h>
#pragma GCC optimize("-Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
using namespace std;
long long MOD = 1e9 + 7;
double eps = 1e-12;
long long mpow(long long a, long long b) {
  if (a == 0) return 0;
  if (b == 0) return 1;
  long long t1 = mpow(a, b / 2);
  t1 *= t1;
  t1 %= MOD;
  if (b % 2) t1 *= a;
  t1 %= MOD;
  return t1;
}
long long mpow(long long a, long long b, long long p) {
  if (a == 0) return 0;
  if (b == 0) return 1;
  long long t1 = mpow(a, b / 2, p);
  t1 *= t1;
  t1 %= p;
  if (b % 2) t1 *= a;
  t1 %= p;
  return t1;
}
long long modinverse(long long a, long long m) {
  long long m0 = m;
  long long y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long q = a / m;
    long long t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
long long range(long long l, long long r) { return l + mt() % (r - l + 1); }
long long rev(long long v) { return mpow(v, MOD - 2); }
long long nc2(long long n) { return (n * (n - 1)) / 2; }
const long long N = 1e5 + 5;
void solve() {
  long long n;
  cin >> n;
  long long c[n];
  for (long long i = 0; i < n; i++) cin >> c[i];
  long long b[n];
  b[n - 1] = 0;
  for (long long i = 0; i < n - 1; i++) cin >> b[i];
  for (long long i = n - 2; i >= 0; i--) b[i] += b[i + 1];
  long long ux = 1e18, lx;
  long long sumb = 0, sumc = 0;
  for (long long i = 0; i < n; i++) sumb += b[i];
  for (long long i = 0; i < n; i++) sumc += c[i];
  lx = sumb / n;
  ux = (sumb + sumc + n - 1) / n;
  long long q;
  cin >> q;
  vector<long long> gdp(N, -1);
  long long nc = 0;
  for (long long i = 0; i < q; i++) {
    long long x;
    cin >> x;
    x += b[0];
    if (x < lx)
      x = lx;
    else if (x > ux)
      x = ux;
    if (gdp[x] == -1) {
      nc++;
      assert(nc < 200);
      long long mpv = 0;
      for (long long i = 0; i < n; i++) {
        mpv += max(long long(0), x - b[i]);
      }
      mpv++;
      vector<long long> dp(mpv + 2, 0);
      dp[0] = 1;
      for (long long i = n - 1; i >= 0; i--) {
        vector<long long> ndp(mpv + 2, 0);
        for (long long k = 0; k < mpv; k++) {
          long long r = max(long long(0), k - (b[i] - x)),
                    l = max(long long(0), k - (b[i] + c[i] - x));
          ndp[0] += (c[i] - (r - l)) * dp[k];
          ndp[1] -= (c[i] - (r - l)) * dp[k];
          r = min(r, mpv);
          l = min(l, mpv);
          ndp[l] += dp[k];
          ndp[r + 1] -= dp[k];
        }
        for (long long k = 0; k < mpv; k++) {
          if (k) {
            ndp[k] += ndp[k - 1];
          }
          ndp[k] %= MOD;
          dp[k] = ndp[k];
        }
      }
      gdp[x] = dp[0];
    }
    cout << (gdp[x] + MOD) % MOD << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  for (long long i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
