#include<bits/stdc++.h>
using namespace std;

// const int N = 100;
const int N = 2e5 + 105;
int n[5], a[5][N];
int m[5], x[5][N], y[5][N];
vector<int> edge[5][N];
void solve(){
    for(int i = 1; i <= 4; ++i) scanf("%d", &n[i]);
    for(int i = 1; i <= 4; ++i){
        for(int j = 1; j <= n[i]; ++j){
            scanf("%d", &a[i][j]);
        }
    }
    for(int i = 1; i <= 3; ++i){
        scanf("%d", &m[i]);
        for(int j = 1; j <= m[i]; ++j){
            scanf("%d%d", &x[i][j], &y[i][j]);
            edge[i][x[i][j]].push_back(y[i][j]);
        }
        for(int j = 1; j < N; ++j){
            sort(edge[i][j].begin(), edge[i][j].end());
        }
    }
    vector<pair<int, int> > v;
    for(int i = 1; i <= n[4]; ++i){
        v.push_back({a[4][i], i});
    }
    int f = 1; 
    for(int i = 3; i >= 1; --i){
        sort(v.begin(), v.end());
        // for(auto it : v) printf("sum = %d, id = %d, ", it.first, it.second);
        // printf("\n");
        vector<pair<int, int> > tmp;
        for(int j = 1; j <= n[i]; ++j){
            for(int k = 0; k < int(v.size()); ++k){
                auto it = lower_bound(edge[i][j].begin(), edge[i][j].end(), v[k].second);
                if(it != edge[i][j].end() && *it == v[k].second) continue;
                tmp.push_back({a[i][j] + v[k].first, j});
                break;
            }
        }    
        v = tmp;
    }
    sort(v.begin(), v.end());
    if(v.empty()){
        printf("-1\n");
    }else{
        printf("%d\n", v[0].first);
    }
}
int main(){
    // #define LOCAL
#ifdef LOCAL
    freopen("in.in", "r", stdin);
    freopen("out.out", "w", stdout);
#endif
    int _ = 1;
    // scanf("%d", &_);
    for(int i = 1; i <= _; ++i) solve();
}