#include <bits/stdc++.h>
using namespace std;
const int N = 105, mod = 1e9 + 7;
int n, q, c[N], b[N];
int dp[N][N * N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
  for (int i = 2; i <= n; i++)
    scanf("%d", &b[i]), b[i] += b[i - 1], b[i] += b[i - 1];
  scanf("%d", &q);
  while (q--) {
    int x;
    scanf("%d", &x);
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    int sc = 0;
    for (int i = 0; i < n; i++) {
      for (int j = max(0, i * x + b[i]); j <= sc; j++) {
        for (int k = 0; k <= c[i + 1]; k++)
          dp[i + 1][j + k] = (dp[i + 1][j + k] + dp[i][j]) % mod;
      }
      sc += c[i + 1];
    }
    int ans = 0;
    for (int j = max(0, n * x + b[n]); j <= sc; j++)
      ans = (ans + dp[n][j]) % mod;
    printf("%d\n", ans);
  }
}
