#include <bits/stdc++.h>

#define MAXN 111
#define BASE 1000000007

using namespace std;

int n;
int b[MAXN], c[MAXN];
int x, q;
int Dp[MAXN][MAXN * MAXN];
int prefixSumB[MAXN];
vector<pair<int, int>> preRes;

int DpCalc(int curX, int totalSum) {
  for (int i = 0; i <= n; i++) {
    for (int sum = 0; sum <= totalSum; sum++) {
      Dp[i][sum] = 0;
    }
  }
  Dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int sum = 0; sum <= totalSum; sum++) {
      int minA = i * curX + prefixSumB[i - 1] - sum;
      minA = max(minA, 0);
      if (minA <= c[i - 1]) {
        Dp[i][sum + minA] = (Dp[i][sum + minA] + Dp[i - 1][sum]) % BASE;
        Dp[i][sum + c[i - 1] + 1] = (Dp[i][sum + c[i - 1] + 1] - Dp[i - 1][sum] + BASE) % BASE;
      }
    }
    for (int sum = 0; sum <= totalSum; sum++) {
      if (sum > 0) Dp[i][sum] = (Dp[i][sum] + Dp[i][sum - 1]) % BASE;
    }
  }
  int res = 0;
  for (int sum = 0; sum <= totalSum; sum++) res = (res + Dp[n][sum]) % BASE;
  return res;
}

int main() {
  cin >> n;
  int total = 0;
  int maxC = 0;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    total += c[i];
    maxC = max(maxC, c[i]);
  } 
  b[0] = prefixSumB[0] = 0;
  int sumB = 0;
  for (int i = 1; i < n; i++) {
    cin >> b[i];
    sumB += b[i];
    prefixSumB[i] = prefixSumB[i - 1] + sumB;
  }
  // pre calc
  x = ((maxC + 1)* n - prefixSumB[n - 1]) / n;
  preRes.push_back(make_pair(x, DpCalc(x, total)));
  while (maxC >= 0) {
    x = (maxC * n - prefixSumB[n - 1]) / n;
    preRes.push_back(make_pair(x, DpCalc(x, total)));
    maxC--;
  }
  x = -100000;
  preRes.push_back(make_pair(x, DpCalc(x, total)));
  // end pre calc
  cin >> q;
  while (q--) {
    cin >> x;
    int res = 0;
    for (int i = 0; i < preRes.size(); i++) {
      if (x >= preRes[i].first) {
        res = preRes[i].second;
        break;
      }
    }
    cout << res << endl;
  }
  return 0;
}