#!/bin/python3 import sys import bisect as bi from collections import Counter def maximumPeople(p, x, y, r): # Return the maximum number of people that will be in a sunny town after removing exactly one cloud. d=[] for i in range(len(y)): l=bi.bisect_left(x,y[i]-r[i]) r=bi.bisect_right(x,y[i]+r[i]) #print(l,r) for j in range(l,r): d.append(j) c=Counter(d) e=[] sa=set(list(range(n))) - set(d) for i in c: if(c[i]==1): e.append(i) f=[] for i in e: sa.add(i) ans=0 for j in sa: ans+=p[j] sa.remove(i) f.append(ans) return max(f) 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)