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

#include <fstream>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    // uncomment the two following lines if you want to read/write from files
    // ifstream cin("input.txt");
    // ofstream cout("output.txt");

    int N;
    cin >> N;

    vector<int> W(N);
    for (int i = 0; i < N; ++i)
        cin >> W[i];

    int M;
    cin >> M;

    vector<int> K(M);
    for (int i = 0; i < M; ++i)
        cin >> K[i];

    vector<int> T(M);
    for (int i = 0; i < M; ++i)
        cin >> T[i];

    int S = 0;


    // INSERT YOUR CODE HERE


    cout << S << endl;

    return 0;
}
