#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 2000000000;
const long long MAXN = 100000;
long long dp[100][20000];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> c(n);
  for (long long i = 0; i < n; i++) {
    cin >> c[i];
  }
  vector<long long> b(n);
  for (long long i = 1; i < n; i++) {
    cin >> b[i];
  }
  vector<long long> bp(n);
  for (long long i = 1; i < n; i++) {
    bp[i] = bp[i - 1] + b[i];
  }
  for (long long i = 1; i < n; i++) {
    bp[i] += bp[i - 1];
  }
  long long q;
  cin >> q;
  for (long long _ = 0; _ < q; _++) {
    long long x;
    cin >> x;
    vector<long long> need(n);
    for (long long i = 0; i < n; i++) {
      need[i] = bp[i] + x * (i + 1);
    }
    for (long long i = 0; i < 100; i++) {
      for (long long j = 0; j <= 10000; j++) {
        dp[i][j] = 0;
      }
    }
    for (long long i = max(0LL, need[0]); i <= c[0]; i++) {
      dp[0][i] = 1;
    }
    for (long long i = 1; i < n; i++) {
      for (long long j = need[i]; j <= 1000; j++) {
        for (long long k = 0; k <= c[i]; k++) {
          if (j < k) {
            break;
          }
          dp[i][j] += dp[i - 1][j - k];
          if (dp[i][j] >= MOD) {
            dp[i][j] -= MOD;
          }
        }
      }
    }
    long long ans = 0;
    for (long long j = 0; j <= 10000; j++) {
      ans += dp[n - 1][j];
    }
    cout << ans % MOD;
  }
}
