#!/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. ap, total, maxi=[],0,0 for i in range(len(p)): flag=False for j in range(len(y)): if (x[i]>=(y[j]-r[j]) and x[i]<=(y[j]+r[j])): flag=True ap.append((p[i], x[i], flag)) for item in ap: if item[2]==False: total+=item[0] else: if item[0]>maxi: maxi=item[0] return total+maxi 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