#!/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. affected = [] unaffected = [] for t in range(len(x)): for i in range(len(y)): if x[t]<=y[i]+r[i] and x[t]>=y[i]-r[i]: affected.append(p[t]) else: unaffected.append(p[t]) if(len(affected)!=0): return sum(unaffected)+max(affected) else: return sum(unaffected) 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)