#!/bin/python3 import sys def maximumPeople(p, x, y, r): pcount = 0 cleffect = [] for h in range(len(y)): cleffect.append(0) for town in range(len(x)): #for each location of town for i in range(len(y)): crange = r[i] if (x[town] >=y[i]-crange and x[town] <=y[i]+crange): #dark cleffect[i] += p[town] else: #sunny pcount += p[town] m = max(cleffect) return(m + pcount) 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)