#!/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_people = 0 for i in x: flag = True j = 0 while j < len(y) and flag == True : if i not in [k for k in range(y[j]-r[j],y[j]+r[j]+1)]: pass j = j + 1 else: flag = False if flag == True: sunny_people = sunny_people + i return sunny_people 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)