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

typedef long long ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pi;
typedef vector<pair<int,int>> vp;

#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define ppc __builtin_popcount
#define ppcll __builtin_popcountll
#define mem(a,b) memset(a,b,sizeof(a))


#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

template<typename T> T gcd(T a, T b) {return (b ? __gcd(a, b) : a);}
template<typename T> T lcm(T a, T b) {return (a * (b / gcd(a, b)));}
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}

const int mod = 1e9+7;
const int max_val = 1e9;

void print(vector<pi> a)
{
    for(auto &x : a)
        cout << x.fi << " " << x.sc << "\n";
    cout << endl << endl;
}

struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};


void solve(){
    int n1,n2,n3,n4;
    cin >> n1 >> n2 >> n3 >> n4;

    // vi a1(n1), a2(n2), a3(n3), a4(n4);
    vector<pi> a1(n1), a2(n2), a3(n3), a4(n4);

    FOR(i,0,n1){
        cin >> a1[i].fi;
        a1[i].sc = i+1;
    }
    FOR(i,0,n2){
        cin >> a2[i].fi;
        a2[i].sc = i+1;
    }
    FOR(i,0,n3){
        cin >> a3[i].fi;
        a3[i].sc = i+1;
    }
    FOR(i,0,n4){
        cin >> a4[i].fi;
        a4[i].sc = i+1;
    }

    sort(a1.begin(), a1.end());
    sort(a2.begin(), a2.end());
    sort(a3.begin(), a3.end());
    sort(a4.begin(), a4.end());

    // print(a1);
    // print(a2);
    // print(a3);
    // print(a4);



    int m1,m2,m3,t1,t2;
    unordered_set <pair<int, int>, hash_pair> pair1, pair2, pair3;
    cin >> m1;
    FOR(i,0,m1){
        cin >> t1 >> t2;
        pair1.insert(mp(t1,t2));
    }
    cin >> m2;
    FOR(i,0,m2){
        cin >> t1 >> t2;
        pair2.insert(mp(t1,t2));
    }
    cin >> m3;
    FOR(i,0,m3){
        cin >> t1 >> t2;
        pair3.insert(mp(t1,t2));
    }

    // for(auto &x : pair1)
    //     cout << x.fi << " " << x.sc << "\n";
    // cout << "\n" << "\n";
    //
    // for(auto &x : pair2)
    //     cout << x.fi << " " << x.sc << "\n";
    // cout << "\n" << "\n";
    //
    // for(auto &x : pair3)
    //     cout << x.fi << " " << x.sc << "\n";
    // cout << "\n" << "\n";


    FOR(i,0,n3){
        bool find = false;
        FOR(j,0,n4){
            if(pair3.find({a3[i].sc,a4[j].sc}) == pair3.end()){
                a3[i].fi += a4[j].fi;
                // cout << "3 i = " << i << " a[i] = " << a3[i].fi << " idx " << a3[i].sc << "\n";
                find = true;
                break;
            }
        }
        if (!find){
            a3[i].fi = max_val;
            // cout << "3 i = " << i << " a[i] = " << a3[i].fi << " idx " << a3[i].sc << "\n";
        }
    }
    sort(a3.begin(), a3.end());

    FOR(i,0,n2){
        bool find = false;
        FOR(j,0,n3){
            if (a3[j].fi == max_val)
                break;
            if(pair2.find({a2[i].sc,a3[j].sc}) == pair2.end()){
                a2[i].fi += a3[j].fi;
                // cout << "2 i = " << i << " a[i] = " << a2[i].fi << " idx " << a2[i].sc << "\n";
                find = true;
                break;
            }
        }
        if (!find){
            a2[i].fi = max_val;
            // cout << "2 i = " << i << " a[i] = " << a2[i].fi << " idx " << a2[i].sc << "\n";
        }
    }
    sort(a2.begin(), a2.end());

    FOR(i,0,n1){
        bool find = false;
        FOR(j,0,n2){
            if (a2[j].fi == max_val)
                break;
            if(pair1.find({a1[i].sc,a2[j].sc}) == pair1.end()){
                a1[i].fi += a2[j].fi;
                // cout << "1 i = " << i << " a[i] = " << a1[i].fi << " idx " << a1[i].sc << "\n";
                find = true;
                break;
            }
        }
        if (!find){
            a1[i].fi = max_val;
            // cout << "1 i = " << i << " a[i] = " << a1[i].fi << " idx " << a1[i].sc << "\n";
        }
    }

    int ans = max_val;
    FOR(i,0,n1){
        amin(ans,a1[i].fi);
    }

    if (ans == max_val)
        cout << "-1\n";
    else
        cout << ans << "\n";

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

    int t=1;
    // cin >> t;
    while(t--){
        solve();
    }

    return 0;
}
