#!/bin/python3 import sys def cloudOverTown(y, r, town): for i in range(max(y)): if i in y: if town >= i-r[i] and town >= i+r[i]: return True return False def maximumPeople(p, x, y, r): #p = population, x = town location, y = cloud location, r = cloud range # Return the maximum number of people that will be in a sunny town after removing exactly one cloud. population = 0 population_plus = 0 for i, t in enumerate(x): if cloudOverTown(y, r, t): if p[i] > population: population = p[i] else: population_plus += p[i] return population + population_plus 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)