#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(i=a; i<b; i++)
#define bac(i,a,b) for(i=a;i>=b;i--)
#define repf(it,x) for(auto it= x.begin(); it!=x.end(); it++)
#define repb(it,x) for(auto it= x.rbegin(); it!=x.rend(); it++)
#define reps(i,a) for(i=0; a[i]!='\0'; i++)
#define fir first
#define sec second
#define b() begin()
#define e() end()
#define all(x) (x).begin(),(x).end()
#define pb(i) push_back(i)
#define ppb() pop_back()
#define ll long long
#define mp(a,b) make_pair(a,b)
#define hell 1000000000000000000
#define M 1000000007

vector<ll> cost[4];
set<pair<ll,ll>> bad[3];

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    long long int i, j,d, m,k, t=1, x=0, y,q,c=0, sum=0, maxx, ans=0, count, minn;
    //cin>> t;
    while(t--){
        ll ni[4], mi[3], flag=1;
        rep(i,0,4) cin>>ni[i];
        rep(j,0,4)
            rep(i,0,ni[j]){
                cin>> x;
                cost[j].pb(x);
            }
            
        rep(j,0,3){
            cin>>mi[j];
            rep(i,0,mi[j]){
                cin>>x>>y;
                bad[j].insert(mp(x-1,y-1));
            }   
        }
        
        vector<pair<ll,ll>> v;
        rep(i,0,ni[0]) v.pb(mp(cost[0][i], i));
        sort(all(v));
        
        rep(j,0,3){
            vector<pair<ll,ll>> v1;
            rep(i,0,ni[j+1]){
                k=0;
                while(k<v.size() && bad[j].find(mp(v[k].sec, i))!=bad[j].e())
                    k++;
                if(k==v.size()) continue;
                v1.pb(mp(v[k].fir+cost[j+1][i], i));
            }
            sort(all(v1));
            v=v1;
        }
        if(!v.empty()) cout<<v[0].fir;
        else cout<<"-1";
        
        cout<<"\n";
    }
}