#include <bits/stdc++.h>
using namespace std;
int readInt() {
  int a;
  scanf("%d", &a);
  return a;
}
long long readLong() {
  long long a;
  scanf("%lld", &a);
  return a;
}
void readString(char *s) { scanf(" %s", s); }
string print(int a) { return to_string(a); }
string print(long long a) { return to_string(a); }
string print(string a) { return a; }
template <typename T1, typename T2>
string print(pair<T1, T2> first) {
  return "(" + print(first.first) + "," + print(first.second) + ")";
}
template <typename T>
string print(vector<T> v) {
  string ans = "[ ";
  for (T e : v) ans += print(e) + " ";
  ans += "]";
  return ans;
}
template <typename T>
string print(T *a, T *b) {
  string ans = "[ ";
  while (a != b) ans += print(*(a++)) + " ";
  ans += "]";
  return ans;
}
const int mod = 1000000007;
int add(int a, int b) { return ((a += b) >= mod) ? a - mod : a; }
int mul(int a, int b) { return a * 1ll * b % mod; }
void adding(int &a, int b) { a = add(a, b); }
int pw(int a, int b) {
  if (a == 0) return 0;
  int ans = 1, res = a;
  for (int i = 1; i <= b; i <<= 1, res = mul(res, res)) {
    if (i & b) ans = mul(ans, res);
  }
  return ans;
}
const int N = 102;
int dp[N][N * N];
int B[N];
int main() {
  dp[0][0] = 1;
  int n = readInt();
  int sum = 0;
  for (int i = (1); i <= (n); ++i) {
    int c = readInt();
    for (int j = (0); j <= (c); ++j) {
      for (int k = (0); k <= (sum); ++k) {
        adding(dp[i][k + j], dp[i - 1][k]);
      }
    }
    sum += c;
  }
  for (int i = (sum - 1); i >= (0); --i) {
    adding(dp[n][i], dp[n][i + 1]);
  }
  int Bsum = 0;
  for (int i = (1); i <= (n - 1); ++i) {
    B[i] = readInt();
    Bsum += B[i] * (n - i);
  }
  int q = readInt();
  while (q--) {
    int first = readInt();
    first = n * first + Bsum;
    first = max(first, 0);
    if (first > sum)
      printf("0\n");
    else
      printf("%d\n", dp[n][first]);
  }
  return 0;
}
