#!/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. a=[] for i in range(0,len(y)): b=[] for j in range(0,len(x)): if((y[i]-r[i])<=x[j] and (y[i]+r[i])>=x[j]): b.append(p[i]) a.append(b) su = 0 for i in range(0,len(a)): if(su=x[i]): c=c+1; if(c==0): po = po + p[i] return po 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