#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <algorithm>
#include <climits>

using namespace std;

int a[4][150000], d[4][150000], n[4];
vector<pair<int, int>> bad;

void match(int from, int to, int n1, int n2) {
    set<pair<int, int>> D, extra;
    int j = 0, m = bad.size();
    sort(bad.begin(), bad.end());
    for (int i = 0; i < n1; i++) {
        D.insert({ d[from][i], i });
    }
    for (int i = 0; i < n2; i++) {
        while (j < m && bad[j].first == i) {
            auto cur = make_pair(d[from][bad[j].second], bad[j].second);
            D.erase(cur);
            extra.insert(cur);
            j++;
        }
        if (!D.empty() && D.begin()->first != INT_MAX) d[to][i] = D.begin()->first + a[to][i];
        while (!extra.empty()) {
            D.insert(*extra.begin());
            extra.erase(extra.begin());
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 150000; j++) {
            d[i][j] = INT_MAX;
        }
    }
    cin >> n[0] >> n[1] >> n[2] >> n[3];
    for (int i = 0; i < n[0]; i++) {
        cin >> a[0][i]; d[0][i] = a[0][i];
    }
    for (int i = 0; i < n[1]; i++) {
        cin >> a[1][i];
    }
    for (int i = 0; i < n[2]; i++) {
        cin >> a[2][i];
    }
    for (int i = 0; i < n[3]; i++) {
        cin >> a[3][i];
    }

    int m1; cin >> m1;
    for (int i = 0; i < m1; i++) {
        int x, y; cin >> x >> y;
        x--; y--;
        bad.push_back({ y, x });
    }
    match(0, 1, n[0], n[1]);
    bad.clear();
    int m2; cin >> m2;
    for (int i = 0; i < m2; i++) {
        int x, y; cin >> x >> y;
        x--; y--;
        bad.push_back({ y, x });
    }
    match(1, 2, n[1], n[2]);
    bad.clear();
    int m3; cin >> m3;
    for (int i = 0; i < m3; i++) {
        int x, y; cin >> x >> y;
        x--; y--;
        bad.push_back({ y, x });
    }
    match(2, 3, n[2], n[3]);

    /*for (int i = 0; i < 4; i++) {
        cout << "dish " << i + 1 << " : ";
        for (int j = 0; j < n[i]; j++) {
            cout << d[i][j] << " ";
        }
        cout << endl;
    }*/

    int ans = INT_MAX;
    for (int i = 0; i < n[3]; i++) {
        ans = min(ans, d[3][i]);
    }
    cout << (ans == INT_MAX ? -1 : ans) << endl;
}
