import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long maximumPeople(long[] p, long[] x, long[] y, long[] r) { // Return the maximum number of people that will be in a sunny town after removing exactly one cloud. long max = Long.MIN_VALUE; for (int i = 0; i < y.length; i++) { long cloudLocation = y[i]; long left = y[i] - r[i]; long right = y[i] + r[i]; //find the cities that are affected long citiesSum = 0; for (int j = 0; j < x.length; j++) { if (left <= x[j] && x[j] <= right) { citiesSum += p[j]; } } max = Math.max(max, citiesSum); } //now that we have the cloud to remove, we can now find the population long total = 0; for (int i = 0; i < p.length; i++) { boolean noTrouble = true; for (int j = 0; j < y.length; j++) { long cloudLocation = y[j]; long left = y[j] - r[j]; long right = y[j] + r[j]; if (left <= x[i] && x[i] <= right) { noTrouble = false; } } if (noTrouble) { total += p[i]; } } return total + max; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long[] p = new long[n]; for(int p_i = 0; p_i < n; p_i++){ p[p_i] = in.nextLong(); } long[] x = new long[n]; for(int x_i = 0; x_i < n; x_i++){ x[x_i] = in.nextLong(); } int m = in.nextInt(); long[] y = new long[m]; for(int y_i = 0; y_i < m; y_i++){ y[y_i] = in.nextLong(); } long[] r = new long[m]; for(int r_i = 0; r_i < m; r_i++){ r[r_i] = in.nextLong(); } long result = maximumPeople(p, x, y, r); System.out.println(result); in.close(); } }