#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
inline long long read() {
  long long x = 0;
  bool flag = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') flag = 0;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return (flag ? x : ~(x - 1));
}
const long long mod = 1e9 + 7;
long long n, q, ans, c[101], b[101], L[101], f[101][101];
signed main() {
  n = read();
  for (long long i = 1; i <= n; i++) c[i] = read();
  for (long long i = 1; i < n; i++) b[i] = b[i - 1] + read();
  q = read();
  while (q--) {
    long long x = read(), cnt = 0, sum = 0;
    ans = 0;
    for (long long i = 1; i <= n; i++) {
      L[i] = max(0ll, x * i + cnt);
      cnt += b[i];
    }
    f[0][0] = 1;
    for (long long i = 1; i <= n; i++) {
      sum += c[i];
      for (long long l = L[i]; l <= sum; l++) {
        for (long long j = 0; j <= l && j <= c[i]; j++)
          (f[i][l] += f[i - 1][l - j]) %= mod;
        if (i == n) (ans += f[i][l]) %= mod;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
