#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif //_MSC_VER

#include <cstdio>

#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <numeric>
#include <ctime>
#include <chrono>
#include <iostream>
#include <string>
#include <sstream>
#include <array>
#include <random>
#include <cmath>
#include <cassert>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <utility>
#include <thread>

using std::cin;
using std::cout;
using std::string;
using std::vector;

using ll = long long;

constexpr int MOD = 1000000000 + 7;  
 
vector<int> solve(vector<int> & c, vector<int> & b, vector<int> & x)
{
	int const n = c.size();
	int const q = x.size();
	vector<int> cb(n);
	for (int i = 1; i <= n - 1; ++i)
		cb[i] = cb[i - 1] + b[i - 1];
	vector<int> d(n);
	for (int i = 1; i <= n - 1; ++i)
		d[i] = d[i - 1] + cb[i];
	vector<int> cc(n + 1);
	for (int i = 1; i <= n; ++i)
		cc[i] = cc[i - 1] + c[i - 1];

	int const maximum = cc[n];
	vector<int> ans(q);
	for (int iq = 0; iq < q; ++iq)
	{
		vector< vector<int >>dp(n + 1, vector<int>(maximum + 1, 0));
		std::fill(dp[n].begin(), dp[n].end(), 1);

		for (int i = n - 1; i >= 0; --i)
		{
			for (int j = 0; j <= cc[i]; ++j)
			{
				for (int k = std::max(0, d[i] + (i + 1)*x[iq] - j); k <= c[i]; ++k)
				{
					assert(j + k <= maximum);
					dp[i][j] += dp[i + 1][j + k];
					dp[i][j] -= (dp[i][j] >= MOD ? MOD : 0);
				}
			}
		}

		ans[iq] = dp[0][0];
	}

	return ans;
}
static int solve(int testcase)
{
	vector<int> c, b, x;
	int n,q;
	cin >> n;
	c.assign(n, 0);
	for (int i = 0; i < n; ++i)
		cin >> c[i];

	b.assign(n - 1, 0);
	for (int i = 0; i < n - 1; ++i)
		cin >> b[i];

	cin >> q;
	x.resize(q);
	for (int i = 0; i < q; ++i)
		cin >> x[i];

	vector<int> ans = solve(c, b, x);
	for (int i = 0; i < q; ++i) {
		if (i)cout << ' ';
		cout << ans[i];
	}
	cout << std::endl;
	return 0;
}

int main(int argc, char* argv[])
{
 
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif //ONLINE_JUDGE
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout.tie(0);
	
	int tc = 1;
	//std::cin >> tc;
	for (int ic = 1; ic <= tc; ++ic)
	{
		solve(ic);
	}

	return 0;
}
