#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
#define setPrecision(n) cout << std::setprecision(n) << std::fixed;
#define rep(i,j,n) for(int i = j; i < n; i++)
#define ll long long
#define pb push_back
#define ppb pop_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define sz(x) ((int) (x).size())
#define all(c) (c).begin(),(c).end()
#define F first
#define S second
#define INF 2e9
#define LINF 2e18
const long long MOD = 1e9 + 7;
const double err = 1e-10;
const int N = 1e5 + 5;

vector<int> apos;

void make_merger(vector<int> &A, vector<int> &B){
    int n1 = sz(A), n2 = sz(B);
    int m1; cin >> m1;
    vector<pii> tmp(m1);
    rep(i,0,m1){
        int x, y;
        cin >> x >> y;
        --x, --y;
        tmp[i] = {x, y};
    }
    vector<pii> uA;
    rep(i,0,n1){
        if(A[i] > 0){
            uA.pb({A[i], i});
        }
    }
    sort(all(uA));
    apos = vi(n1, INT_MAX);
    rep(i,0,sz(uA)){
        apos[uA[i].S] = i;
    }

    sort(all(tmp), [](pii a, pii b){
        return ((a.S < b.S) || ((a.S == b.S) && (apos[a.F] < apos[b.F])));
    });

    int pos = 0;
    rep(i,0,n2){
        int mn = 0;
        while(pos < m1 && tmp[pos].S == i){
            if(mn == apos[tmp[pos].F]) mn++;
            pos++;
        }
        if(mn < sz(uA)){
            B[i] += uA[mn].F;
        }
        else{
            B[i] = -1;
        }
    }
}

void solve(){
    int n1, n2, n3, n4;
    cin >> n1 >> n2 >> n3 >> n4;
    vector<int> A(n1), B(n2), C(n3), D(n4);
    rep(i,0,n1) cin >> A[i];
    rep(i,0,n2) cin >> B[i];
    rep(i,0,n3) cin >> C[i];
    rep(i,0,n4) cin >> D[i];


    make_merger(A, B);
    make_merger(B, C);
    make_merger(C, D);

    int mn = INT_MAX;
    rep(i,0,n4){
        if(D[i] > 0){
            mn = min(mn, D[i]);
        }
    }

    cout << (mn == INT_MAX ? -1 : mn) << endl;
}

int main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    FASTER;
    int T = 1;
    // cin >> T;
    while (T--) solve();
    return 0;
}

/*
    1. Read Problem Statement Carefully.
    2. Read Test Cases.
    3. Be sure about the logic before implementation.
*/
