#!/bin/python3 import copy import sys def maximumPeople(p, x, y, r): #p-list of population #x-list of location #m no.-clouds #y-location of cloud list #r=range of cloud # Return the maximum number of people that will be in a sunny town after removing exactly one cloud. if len(y)==0 or len(y)==1:return sum(p) ans=[] for i in range(len(y)): s=0 cloudLoca=y[i] for i in x: if i >= y[i]-r[i] and i<=y[i]+r[i]: continue else: s+=p[i] ans.append(s) return max(ans) 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)