#!/bin/python3 import sys import bisect def maximumPeople(p, x, y, r): # Return the maximum number of people that will be in a sunny town after removing exactly one cloud. clouds = (n+1)*[0] x, p = zip(*sorted(zip(x, p))) for i in range(m): s = y[i] - r[i] e = y[i] + r[i] if (s > x[-1] or e < x[0]): continue ps = bisect.bisect(x, s) pe = bisect.bisect_left(x, e) if (pe >= n): pe = n-1 #print (ps, pe) clouds[ps] += 1 clouds[pe+1] -= 1 #print (clouds) free = 0 cur_clouds = clouds[0] if (cur_clouds == 0): free = p[0] for i in range(1, n): cur_clouds += clouds[i] if (cur_clouds == 0): free += p[i] max_free = 0 cur_clouds = clouds[0] if (cur_clouds == 1): cur_free = p[0] for i in range(1, n): cur_clouds += clouds[i] if (cur_clouds == 1): cur_free += p[i] else: max_free = max(max_free, cur_free) max_free = max(max_free, cur_free) return free + max_free 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)