#include <bits/stdc++.h>
using namespace std;
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL)
#define int long long
#define ll long long
#define ld long double
#define all(v) v.begin(), v.end()
#define endl "\n"
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll MAX = 2e5 + 5;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll add(ll a, ll b) { return ((a % mod) + (b % mod)) % mod; }
inline ll mul(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; }
inline ll sub(ll a, ll b) { return ((a % mod) - (b % mod) + mod) % mod; }
inline ll power(ll x, ll n) {
    if (!n) {
        return 1;
    }
    return (n & 1 ? mul(x, power(mul(x, x), n / 2)) : power(mul(x, x), n / 2));
}

void solve() {
    int n1, n2, n3, n4;
    cin >> n1 >> n2 >> n3 >> n4;
    vector<int> a(n1), b(n2), c(n3), d(n4);
    multiset<int> A, B, C, D;
    for (int i = 0; i < n1; i++) cin >> a[i];
    for (int i = 0; i < n2; i++) cin >> b[i];
    for (int i = 0; i < n3; i++) cin >> c[i];
    for (int i = 0; i < n4; i++) cin >> d[i], D.insert(d[i]);
    int m1, m2, m3, u, v;
    set<int> ab[n1], bc[n2], cd[n3];
    cin >> m1;
    for (int i = 0; i < m1; i++) {
        cin >> u >> v;
        u--, v--;
        ab[u].insert(v);
    }
    cin >> m2;
    for (int i = 0; i < m2; i++) {
        cin >> u >> v;
        u--, v--;
        bc[u].insert(v);
    }
    cin >> m3;
    for (int i = 0; i < m3; i++) {
        cin >> u >> v;
        u--, v--;
        cd[u].insert(v);
    }

    vector<int> cd_ans(n3, -1);
    for (int i = 0; i < n3; i++) {
        for (auto v : cd[i]) {
            D.erase(D.find(d[v]));
        }
        if (D.size()) {
            cd_ans[i] = c[i] + (*D.begin());
        }
        for (auto v : cd[i]) {
            D.insert(d[v]);
        }
    }
    for (auto poss : cd_ans) {
        if (poss != -1) {
            C.insert(poss);
        }
    }

    vector<int> bc_ans(n2, -1);
    for (int i = 0; i < n2; i++) {
        for (auto v : bc[i]) {
            if (cd_ans[v] != -1) {
                C.erase(C.find(cd_ans[v]));
            }
        }
        if (C.size()) {
            bc_ans[i] = b[i] + (*C.begin());
        }
        for (auto v : bc[i]) {
            if (cd_ans[v] != -1) {
                C.insert(cd_ans[v]);
            }
        }
    }
    for (auto poss : bc_ans) {
        if (poss != -1) {
            B.insert(poss);
        }
    }

    vector<int> ab_ans(n1, -1);
    for (int i = 0; i < n1; i++) {
        for (auto v : ab[i]) {
            if (bc_ans[v] != -1) {
                B.erase(B.find(bc_ans[v]));
            }
        }
        if (B.size()) {
            ab_ans[i] = a[i] + (*B.begin());
        }
        for (auto v : ab[i]) {
            if (bc_ans[v] != -1) {
                B.insert(bc_ans[v]);
            }
        }
    }
    int ans = 1e18;
    for (auto poss : ab_ans) {
        if (poss != -1) {
            ans = min(ans, poss);
        }
    }

    cout << (ans == 1e18 ? -1 : ans) << endl;
}

signed main() {
    fastio;

    int t = 1;
    // cin >> t;

    while (t--) {
        solve();
    }
    return 0;
}