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) { //p = population //x = location of ith town //y = location of yth cloud //r = range of rth cloud int i = 0, po = 0, f = 0; long s = 0, max = 0, dark = 0; for(i = 0; i < y.length; i++) { for(int j = 0; j < x.length; j++) { if(x[j] == y[i]) { f = 1; dark += p[j]; } } } i = 0; while(i < p.length) { if(max > p[i]) { max = p[i]; po = i; } s = s + p[i]; i++; } if(f == 1) { s -= dark; s += p[po]; } return s; } 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(); } }