#!/bin/python3 import sys def maximumPeople(p, x, y, r,n,m): # Return the maximum number of people that will be in a sunny town after removing exactly one cloud. maxt = 0 maxp = 0 d = 0 ans=0 for i in range(m): for j in range(n): if x[j] >= y[i]+r[i] and x[j] <= y[i]+r[i]: d += p[j] if p[j]>maxp: maxp=p[j] maxt=x[j] for i in range(n): ans += p[i] return ans - d + maxp 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,n,m) print(result)