#!/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. no_clouds = len(y) range_list = [] towns = {} towns_flag = {} sum_sunny = 0 pop = {} i=0 for u in x: pop[u] = p[i] i+1 for i in range(no_clouds): range_list.append((y[i]-r[i]+1, y[i]+r[i]+1)) for q in x: towns[q] = 0 towns_flag[q] = 0 for i in range_list: t=i[0] y=i[1] if q in range(t, y): #if q in j: towns_flag[q] = 1 #print(towns) # print(pop) for i in x: towns[i] = towns[i]*pop[i] for j in (towns): if j==0: sum_sunny+=pop[j] return max(towns) + 10 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)