#!/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. sunny = 0 covered = [] range_list = [(y-r,y+r) for y,r in zip(y,r)] for i in x: for r in range_list: if i in r: covered.append(i) else: sunny += p[x.index(i)] sunny += max([p[x.index(i)] for i in covered]) return sunny 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)