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,int n,int l) { long u=0; long[] m=new long[n]; for(int i=0;i0&&x[i].compareTo(y[j]+r[j])<=0)u++; else if(x[i].compareTo(y[j])<0&&x[i].compareTo(y[j]-r[j])>=0)u++; } m[i]=u; } long t=0,q=0; for(int i=0;i0) q=p[i]; } return t+q; } 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,n,m); System.out.println(result); in.close(); } }