#!/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. dict = {} rain = [] ans = sum(p) for i in range(0,len(p)): dict[x[i]] = p[i] for i in range(0,len(y)): rain.append([y[i] - r[i],y[i] + r[i]]) for i in range(0, len(rain)): pop = 0 for j in range(0,len(rain)): if (i != j): for k,v in dict.items(): if rain[j][0] <= k <= rain[j][1]: pop -= v ans = max(ans,pop) return ans 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)