#include using namespace std; long maximumPeople(vector p, vector x, vector y, vector r, int n, int m) { // Return the maximum number of people that will be in a sunny town after removing exactly one cloud. // number of towns n // numer of clouds m // population p // location of towns x // location of clouds y // range of clouds r int sum=0; /* if(m > 1){ int a=p[0], c=0; for(int b=0; b < n; b++) { if((a < p[b]) && y[b]+r[b]) { a=p[b]; c=b; } } } else {*/ for(int b=0; b < n; b++) sum+=p[b]; // } return sum; } int main() { int n; cin >> n; vector p(n); for(int p_i = 0; p_i < n; p_i++){ cin >> p[p_i]; } vector x(n); for(int x_i = 0; x_i < n; x_i++){ cin >> x[x_i]; } int m; cin >> m; vector y(m); for(int y_i = 0; y_i < m; y_i++){ cin >> y[y_i]; } vector r(m); for(int r_i = 0; r_i < m; r_i++){ cin >> r[r_i]; } long result = maximumPeople(p, x, y, r, n, m); cout << result << endl; return 0; }