#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cout << *x, 0);
template <class c>
char dud(...);
struct debug {
  ~debug() { cout << '\n'; }
  template <class c>
  typename enable_if<sizeof dud<c>(0) != 1, debug&>::type operator<<(c i) {
    cout << boolalpha << i;
    return *this;
  }
  template <class c>
  typename enable_if<sizeof dud<c>(0) == 1, debug&>::type operator<<(c i) {
    return *this << range(begin(i), end(i));
  }
  template <class c, class b>
  debug& operator<<(pair<b, c> d) {
    return *this << "(" << d.first << ", " << d.second << ")";
  }
  template <class c>
  debug& operator<<(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it;
    return *this << "]";
  }
};
long long int dp[10005];
long long int tmp[10005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    long long int n;
    cin >> n;
    long long int c[n + 1];
    for (long long int i = 1; i <= n; i++) cin >> c[i];
    long long int b[n];
    for (long long int i = 1; i < n; i++) cin >> b[i];
    dp[0] = 1;
    for (long long int i = 1; i <= n; i++) {
      for (long long int j = 0; j < 10005; j++) {
        tmp[j] = dp[j];
      }
      memset(dp, 0, sizeof(dp));
      for (long long int j = 0; j < 10005; j++) {
        for (long long int k = 0; k <= c[i]; k++) {
          if (k + j < 10005) dp[k + j] = (dp[k + j] + tmp[j]) % 1000000007;
        }
      }
    }
    long long int q;
    cin >> q;
    while (q--) {
      long long int x;
      cin >> x;
      long long int val = 0;
      val += n * x;
      for (long long int i = 1; i < n; i++) {
        val += b[i] * (n - i);
      }
      long long int ans = 0;
      for (long long int i = val; i < 10005; i++) {
        ans = (ans + dp[i]) % 1000000007;
      }
      cout << ans << '\n';
    }
  }
  return 0;
}
