// NOTE: it is recommended to use this even if you don't understand the following code.

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#define MAXM 5000
#define MAXN 5000

int M, N, S, i;
int W[MAXN];
int K[MAXM], T[MAXM];

int main() {
    // uncomment the two following lines if you want to read/write from files
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    assert(1 == scanf("%d", &N));

    for (i = 0; i < N; ++i)
        assert(1 == scanf("%d", &W[i]));

    assert(1 == scanf("%d", &M));

    for (i = 0; i < M; ++i)
        assert(1 == scanf("%d", &K[i]));

    for (i = 0; i < M; ++i)
        assert(1 == scanf("%d", &T[i]));

    S = 0;


    // INSERT YOUR CODE HERE


    printf("%d\n", S);

    return 0;
}
