#include <bits/stdc++.h>

using namespace std;

const int N = 110;
long long b[N], f[N][N * N], n;
int c[N];
const int mod = 1e9 + 7;

int main() {
	//freopen("in.txt", "r", stdin);

	int n;
	cin >> n;
	long long s = 0;
	for (int i = 1; i <= n; i++) {
		cin >> c[i];
	}

	for (int i = 1; i < n; i++) {
		cin >> b[i];
	}

	for (int i = 1; i <= n; i++) b[i] += b[i - 1];
	for (int i = 1; i <= n; i++) b[i] += b[i - 1];

	int q;
	cin >> q;
	while (q--) {
		long long x;
		cin >> x;
		
		f[0][0] = 1;
		for (int i = 1; i <= n; i++)
			for (int j = max(0ll, b[i - 1] + i * x); j <= 10000; j++) 
				for (int k = 0; k <= min(j, c[i]); k++)
					f[i][j] = (f[i][j] + f[i - 1][j - k]) % mod;
		
		long long ans = 0;
		for (int j = 0; j <= 10000; j++)
			ans = (ans + f[n][j]) % mod;
		cout << ans << '\n';
	}

	return 0;
}