#!/bin/python3 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(len(x)): for j in range(len(y)): if y[j]-r[j]>=x[i] and y[j]+r[j]<=x[i]: if j in a: a[j]+=p[i] else: a[j]=p[i] tp=0 for i in p: tp+= i sp=0 m=0 for i in a: if a[i] > m: m=a[i] sp+=a[i] return tp-sp+m 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)