#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cmath>
#include <climits>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
#include <functional>
#include <algorithm>

using namespace std;

#define cin_desync()                      \
	do {                                  \
		ios_base::sync_with_stdio(false); \
		cin.tie(0);                       \
	} while (0)                           \

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}

#else
#define trace(...)
#endif // ifndef ONLINE_JUDGE

typedef long double ld;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

struct event_t {
	int type; /* 2 -> town, 0 -> cloud begin, 1 -> cloud end */
	int x;
	int id;
	bool operator<(const event_t &other) const
	{
		return tie(x, type) < tie(other.x, other.type);
	}
};

const int max_N = 2e5 + 10;
ll profit[max_N]; /* profit from removing i-th cloud */
ll p[max_N]; int x[max_N];
int y[max_N], r[max_N];

int main()
{
	cin_desync();

	int N;
	cin >> N;

	vector<event_t> events;
	for (int i = 1; i <= N; ++i) {
		cin >> p[i];
	}
	for (int i = 1; i <= N; ++i) {
		cin >> x[i];
		events.push_back({2, x[i], i});
	}

	int M;
	cin >> M;

	for (int i = 1; i <= M; ++i) {
		cin >> y[i];
	}
	for (int i = 1; i <= M; ++i) {
		cin >> r[i];
		events.push_back({0, y[i] - r[i], i});
		events.push_back({1, y[i] + r[i] + 1, i});
	}

	sort(events.begin(), events.end());

	set<int> active_clouds;
	ll ans = 0;
	for (auto &e : events) {
		if (e.type == 0) {
			active_clouds.insert(e.id);
		} else if (e.type == 1) {
			active_clouds.erase(e.id);
		} else {
			if (active_clouds.empty()) {
				ans += p[e.id];
			} else if (active_clouds.size() == 1) {
				int v = *active_clouds.begin();
				profit[v] += p[e.id];
			}
		}
	}

	ll mx = 0;
	for (int i = 1; i <= M; ++i) {
		mx = max(mx, profit[i]);
	}

	cout << mx + ans << endl;
}