#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:512000000")
using namespace std;
using li = long long;
using ld = long double;
void solve(bool);
void precalc();
clock_t start;
int main() {
  start = clock();
  int t = 1;
  cout.sync_with_stdio(0);
  cin.tie(0);
  cout.precision(20);
  cout << fixed;
  precalc();
  int test_num = 1;
  while (t--) {
    solve(true);
  }
  cout.flush();
  return 0;
}
template <typename T>
T binpow(T q, T w, T mod) {
  if (!w) return 1 % mod;
  if (w & 1) return q * 1LL * binpow(q, w - 1, mod) % mod;
  return binpow(q * 1LL * q % mod, w / 2, mod);
}
template <typename T>
T gcd(T q, T w) {
  while (w) {
    q %= w;
    swap(q, w);
  }
  return q;
}
template <typename T>
T lcm(T q, T w) {
  return q / gcd(q, w) * w;
}
template <typename T>
void make_unique(vector<T>& vec) {
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
}
template <typename T>
void relax_min(T& cur, T val) {
  cur = min(cur, val);
}
template <typename T>
void relax_max(T& cur, T val) {
  cur = max(cur, val);
}
mt19937 rng(
    (unsigned long long)chrono::steady_clock::now().time_since_epoch().count());
void precalc() {}
const li mod = 1000000007;
void add(li& cur, li val) {
  cur += val;
  cur %= mod;
}
void solve(__attribute__((unused)) bool read) {
  li n;
  vector<li> c;
  vector<li> b;
  cin >> n;
  c.resize(n);
  for (li& x : c) {
    cin >> x;
  }
  b.resize(n - 1);
  for (li& x : b) {
    cin >> x;
  }
  vector<vector<li>> sum_dp(n, vector<li>(n * 100 + 1, 0));
  sum_dp[1][0] = 1;
  for (li i = 1; i + 1 < n; ++i) {
    for (li s = 0; s < sum_dp[i].size(); ++s) {
      if (sum_dp[i][s] == 0) {
        continue;
      }
      for (li take = 0; take <= c[i]; ++take) {
        add(sum_dp[i + 1][s + take], sum_dp[i][s]);
      }
    }
  }
  for (li i = 0; i < n; ++i) {
    for (li s = (li)sum_dp[i].size() - 2; s >= 0; --s) {
      add(sum_dp[i][s], sum_dp[i][s + 1]);
    }
  }
  vector<vector<li>> cached_by_first_and_pref(c[0] + 1, vector<li>(n));
  for (li val = 0; val <= c[0]; ++val) {
    li required_sum = val;
    for (li pref = 0; pref < n; ++pref) {
      li res = 1;
      li need_sum = required_sum;
      for (li suf = pref + 1; suf < n; ++suf) {
        need_sum += b[suf - 1];
        if (need_sum >= c[suf]) {
          res = 0;
          break;
        }
        res = res * (c[suf] - need_sum) % mod;
      }
      cached_by_first_and_pref[val][pref] = res;
      required_sum += b[pref];
    }
  }
  vector<li> b_pref_sum(n, 0);
  vector<li> cached_b_sum(n, 0);
  {
    li pref_sum = 0;
    for (li k = 1; k < n; ++k) {
      add(pref_sum, b[k - 1]);
      b_pref_sum[k] = pref_sum;
      cached_b_sum[k] = (cached_b_sum[k - 1] + pref_sum) % mod;
    }
  }
  li Q;
  cin >> Q;
  while (Q--) {
    li x;
    cin >> x;
    li res = 0;
    for (li val = max(0LL, x); val <= c[0]; ++val) {
      for (li k = 0; k < n; ++k) {
        li mult = cached_by_first_and_pref[val][k];
        if (mult == 0) {
          continue;
        }
        if (k == 0) {
          if (val >= x) {
            add(res, mult);
          }
          continue;
        }
        for (li ak = 0; ak <= min(c[k], b_pref_sum[k] + val); ++ak) {
          li border = x * (k + 1) + cached_b_sum[k] - val - ak;
          border = max(border, 0LL);
          if (border < sum_dp[k].size()) {
            add(res, mult * sum_dp[k][border]);
          }
        }
      }
    }
    res %= mod;
    cout << res << "\n";
  }
}
