#!/bin/python3 import sys def maximumPeople(p, x, y, r,m): affectingTheMost = 0 alreadySunny = [] for k in range(0,len(x)): alreadySunny.append(True) for cloud in range(0,len(y)): max = y[cloud]+r[cloud]; min = y[cloud]-r[cloud] population = 0 for town in range(0,m): if x[town]<=max and x[town]>=min: population += p[town] alreadySunny[town] = False if population > affectingTheMost: affectingTheMost = population additionofsunny = 0 for j in range(0,len(x)): if alreadySunny[j] == True: additionofsunny += p[j] return affectingTheMost+additionofsunny # Return the maximum number of people that will be in a sunny town after removing exactly one cloud. 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,m) print(result)