#include <bits/stdc++.h>
using namespace std;

struct event {
	long long x;
	int type, id;
	bool operator<(const event &e) const {
		return x < e.x || x == e.x && type < e.type;
	}
};

long long maximumPeople(vector <long long> p, vector <long long> x, vector <long long> y, vector <long long> r) {
    // Return the maximum number of people that will be in a sunny town after removing exactly one cloud.
	vector<event> v;
	for (int i = 0; i < x.size(); i++)
		v.push_back({x[i], 1, i});
	for (int i = 0; i < y.size(); i++) {
		v.push_back({y[i] - r[i], 0, i});
		v.push_back({y[i] + r[i], 2, i});
	}
	sort(v.begin(), v.end());
	set<long long> st;
	long long sum = 0;
	map<long long, long long> mp;
	for (auto e: v) {
		if (e.type == 0)
			st.insert(e.id);
		else if (e.type == 2)
			st.erase(e.id);
		else {
			if (st.size() == 0)
				sum += p[e.id];
			else if (st.size() == 1)
				mp[*st.begin()] += p[e.id];
		}
	}
	long long maxsum = sum;
	for (auto p: mp)
		maxsum = max(maxsum, sum + p.second);
	return maxsum;
}

int main() {
    int n;
    cin >> n;
    vector<long long> p(n);
    for(int p_i = 0; p_i < n; p_i++){
       cin >> p[p_i];
    }
    vector<long long> x(n);
    for(int x_i = 0; x_i < n; x_i++){
       cin >> x[x_i];
    }
    int m;
    cin >> m;
    vector<long long> y(m);
    for(int y_i = 0; y_i < m; y_i++){
       cin >> y[y_i];
    }
    vector<long long> r(m);
    for(int r_i = 0; r_i < m; r_i++){
       cin >> r[r_i];
    }
    long long result = maximumPeople(p, x, y, r);
    cout << result << endl;
    return 0;
}