#!/bin/python3 import sys import collections def maximumPeople(p, x, y, r): # Return the maximum number of people that will be in a sunny town after removing exactly one cloud. #print(p,x,y,r) #[10, 100] [5, 100] [4] [1] #p is list of populations #x is coordinate #y is list of cloud centers #r is range of each cloud peopleDict = {} for townI,townPop in enumerate(p): townLoc = x[townI] peopleDict[townLoc] = townPop #sortedPeople = collections.OrderedDict(sorted(peopleDict.items())) #If we could get some kind of a list, concern is double counting #I think the sorted cloudDict = {} #cloudList = [] for cloudI, cloud in enumerate(y): cloudRange = (cloud-r[cloudI],cloud+r[cloudI]) for i in range(cloudRange[0],cloudRange[1]+1): try: cloudDict[i]+=1 except: cloudDict[i]=1 #cloudList.append(cloudRange) freeTally = 0 maxSave = 0 for key in peopleDict: clouds = cloudDict.get(key,0) if clouds==0: freeTally+=peopleDict[key] elif clouds==1: if peopleDict[key]>maxSave: maxSave = peopleDict[key] return freeTally+maxSave if __name__ == "__main__": n = int(input().strip()) p = list(map(int, input().strip().split(' '))) x = list(map(int, input().strip().split(' '))) m = int(input().strip()) y = list(map(int, input().strip().split(' '))) r = list(map(int, input().strip().split(' '))) result = maximumPeople(p, x, y, r) print(result)