#!/bin/python import sys def maximumPeople(p, x, y, r): # Return the maximum number of people that will be in a sunny town after removing exactly one cloud. popu = p cloudx = y #print popu, x, cloudx, r cloud_pop = {} sunnyb4 = 0 for i in range(len(x)): for j in range(len(cloudx)): left, right = cloudx[j] - r[j], cloudx[j] + r[j] if x[i] >= left and x[i] <= right: # town i is located under range of cloud j currentpop = cloud_pop.get(j, 0) cloud_pop[j] = currentpop + popu[i] else: # town i is dry sunnyb4 += popu[i] return sunnyb4 + max(cloud_pop.values()) if __name__ == "__main__": n = int(raw_input().strip()) p = map(long, raw_input().strip().split(' ')) x = map(long, raw_input().strip().split(' ')) m = int(raw_input().strip()) y = map(long, raw_input().strip().split(' ')) r = map(long, raw_input().strip().split(' ')) result = maximumPeople(p, x, y, r) print result