#!/bin/python3 import sys def maximumPeople(p, x, y, r): dark_city_set = []; cloud_count = [0 for i in range(len(x))] for i in range(len(y)): for j in range((y[i]-r[i]),(y[i]+r[i]+1)): if j >= 0 and j < len(x): cloud_count[j] += 1 max_sunny_population = 0 mx_sy_after_cremove = 0 for i in range(len(cloud_count)): if cloud_count[i] == 0: max_sunny_population += p[i] elif cloud_count[i] == 1: if p[i] > mx_sy_after_cremove: mx_sy_after_cremove = p[i] max_sunny_population += mx_sy_after_cremove return max_sunny_population 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)