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