#include <bits/stdc++.h>
using namespace std;
const int md = 1000000007, MID = 111 * 111;
int n, q, x, i, j, k, cur, len, b[111], c[111], f[111][11111];
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &c[i]);
  for (i = 1; i < n; i++) {
    scanf("%d", &b[i]);
    cur += b[i];
    len += cur;
  }
  for (i = 0; i <= c[n]; i++) f[n][i] = 1;
  for (i = n - 1; i > 0; i--)
    for (j = 0; j <= 10000; j++)
      for (k = 0; k <= c[i] && j - k >= 0; k++)
        if ((f[i][j] += f[i + 1][j - k]) >= md) f[i][j] -= md;
  scanf("%d", &q);
  while (q--) {
    scanf("%d", &x);
    k = x * n + len;
    cur = 0;
    for (j = max(k, 0); j <= 10000; j++)
      if ((cur += f[1][j]) >= md) cur -= md;
    printf("%d\n", cur);
  }
  return 0;
}
