#include <bits/stdc++.h>
using namespace std;
int n, m;
int c[109], b[109];
int smb[109];
int f[109][10009], g[10009];
int pt[109], smc[109];
pair<int, int> q[100009];
int ans[100009];
void dp() {
  f[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    smc[i] = smc[i - 1] + c[i];
    for (int j = 0; j <= smc[i]; j++) {
      for (int k = 0; k <= min(j, c[i]); k++)
        f[i][j] = (f[i][j] + f[i - 1][j - k]) % 1000000007;
    }
  }
}
int mo(int x) {
  memset(f, 0, sizeof(f));
  f[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    int mn = (i * (2 * x + smb[i - 1]) + 1) / 2;
    for (int j = mn; j <= smc[i]; j++) {
      for (int k = 0; k <= min(j, c[i]); k++)
        f[i][j] = (f[i][j] + f[i - 1][j - k]) % 1000000007;
    }
  }
  int ans = 0;
  for (int i = 0; i <= smc[n]; i++) ans = (ans + f[n][i]) % 1000000007;
  return ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", c + i);
  for (int i = 1; i <= n - 1; i++)
    scanf("%d", b + i), smb[i] = smb[i - 1] + b[i];
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &q[i].first);
    q[i].second = i;
  }
  sort(q + 1, q + m + 1);
  dp();
  for (int i = 1; i <= m; i++) ans[q[i].second] = mo(q[i].first);
  for (int i = 1; i <= m; i++) printf("%d\n", ans[i]);
  return 0;
}
