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

const
    MAXM = 5000;
    MAXN = 5000;

var
    M, N, S, i : LongInt;
    W          : Array[0..MAXN-1] of LongInt;
    K, T       : Array[0..MAXM-1] of LongInt;

begin
{
    uncomment the two following lines if you want to read/write from files
    assign(input,  'input.txt');  reset(input);
    assign(output, 'output.txt'); rewrite(output);
}

    ReadLn(N);

    for i:=0 to N-1 do
        Read(W[i]);
    ReadLn();

    ReadLn(M);

    for i:=0 to M-1 do
        Read(K[i]);
    ReadLn();

    for i:=0 to M-1 do
        Read(T[i]);
    ReadLn();

    S := 0;

    { INSERT YOUR CODE HERE }


    WriteLn(S);

end.
