#include <bits/stdc++.h>
using namespace std;
template <typename num_t>
inline void add_mod(num_t& a, const long long& b, const int& m) {
  a = (a + b) % m;
  if (a < 0) a += m;
}
template <typename num_t>
inline bool update_max(num_t& a, const num_t& b) {
  return a < b ? a = b, true : false;
}
template <typename num_t>
inline bool update_min(num_t& a, const num_t& b) {
  return a > b ? a = b, true : false;
}
template <typename num_t>
num_t gcd(num_t lhs, num_t rhs) {
  return !lhs ? rhs : gcd(rhs % lhs, lhs);
}
template <typename num_t>
num_t pw(num_t n, num_t k, num_t mod) {
  num_t res = 1;
  for (; k > 0; k >>= 1) {
    if (k & 1) res = 1ll * res * n % mod;
    n = 1ll * n * n % mod;
  }
  return res;
}
int invserse(int n, int mod) { return pw(n, mod - 2, mod); }
const int mod = 1e9 + 7;
void solve() {
  int n;
  cin >> n;
  vector<int> c(n);
  for (int i = (0), _b = (n); i < _b; ++i) cin >> c[i];
  vector<int> b(n, 0);
  for (int i = (1), _b = (n); i < _b; ++i) {
    cin >> b[i];
    b[i] += b[i - 1];
  }
  vector<int> sum_b(n, 0);
  for (int i = (0), _b = (n); i < _b; ++i) {
    sum_b[i] = b[i];
    if (i) sum_b[i] += sum_b[i - 1];
  }
  const int base = 10007;
  map<int, int> pre_calc;
  int mx_a = *max(c.begin(), c.end());
  function<int(int)> get_value = [&](int x) -> int {
    if (x > c[0]) return 0;
    if (pre_calc.count(x)) return pre_calc[x];
    if (x < 0 && sum_b.back() == 0) {
      return 0;
    }
    if (x < -sum_b.back() / n - 1) return get_value(-sum_b.back() / n - 1);
    if (x < 0 && (mx_a - sum_b.back()) / n < x)
      return get_value((mx_a - sum_b.back()) / n);
    vector<int> pre, cur;
    cur.assign(base, 0);
    for (int val = (max(0, x)), _b = (c[0] + 1); val < _b; ++val) {
      cur[val] = 1;
    }
    for (int i = (1), _b = ((int)(cur).size()); i < _b; ++i)
      cur[i] += cur[i - 1];
    for (int i = (1), _b = (n); i < _b; ++i) {
      pre = cur;
      fill(cur.begin() + max(0, i * x + sum_b[i - 1]), cur.end(), 0);
      for (int sum = (max(0, (i + 1) * x + sum_b[i])), _b = ((int)(cur).size());
           sum < _b; ++sum) {
        cur[sum] = pre[sum];
        if (sum - c[i] - 1 >= 0) {
          add_mod(cur[sum], -pre[sum - c[i] - 1], mod);
        }
        if (sum) add_mod(cur[sum], cur[sum - 1], mod);
      }
    }
    pre_calc[x] = cur.back();
    return cur.back();
  };
  int q = 0;
  cin >> q;
  while (q-- > 0) {
    int x;
    cin >> x;
    cout << get_value(x) << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  const bool multiple_test = false;
  int test = 1;
  if (multiple_test) cin >> test;
  for (int i = 0; i < test; ++i) {
    solve();
  }
}
