#include <bits/stdc++.h>

#define fi first
#define se second
#define ll long long
#define dl double long

using namespace std;

const int N = 1e6 + 7;
const long long mod = 1e9 + 7;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n1,n2,n3,n4;
int m1,m2,m3;
int a[N];
int b[N];
int c[N];
int d[N];
int ans[N];
vector < int > v[N];

void solve()
{
    cin >> n1 >> n2 >> n3 >> n4;
    for( int i = 1; i <= n1; i++ )cin >> a[i];
    for( int i = 1; i <= n2; i++ )cin >> b[i];
    for( int i = 1; i <= n3; i++ )cin >> c[i];
    for( int i = 1; i <= n4; i++ )cin >> d[i];
    cin >> m1;
    for( int i = 1; i <= m1; i++ ){
        int x,y;
        cin >> x >> y;
        y += n1;
        v[x].push_back(y);
    }
    cin >> m2;
    for( int i = 1; i <= m2; i++ ){
        int x,y;
        cin >> x >> y;
        x += n1;
        y += n1 + n2;
        v[x].push_back(y);
    }
    cin >> m3;
    for( int i = 1; i <= m3; i++ ){
        int x,y;
        cin >> x >> y;
        x += n1 + n2;
        y += n1 + n2 + n3;
        v[x].push_back(y);
    }
    int n = n1 + n2 + n3 + n4;
    for( int i = n1 + n2 + n3 + 1; i <= n; i++ ){
        ans[i] = d[i - n1 - n2 - n3];
    }
    multiset < int > s;
    for( int i = n1 + n2 + n3 + 1; i <= n; i++ ){
        s.insert(ans[i]);
    }
    for( int i = n1 + n2 + 1; i <= n1 + n2 + n3; i++ ){
        for( auto x : v[i] ){
            s.erase(s.find(ans[x]));
        }
        if( s.empty() )ans[i] = -1;
        else ans[i] = c[i - n1 - n2] + *s.begin();
        for( auto x : v[i] ){
            s.insert(ans[x]);
        }
    }
    s.clear();
    for( int i = n1 + n2 + 1; i <= n1 + n2 + n3; i++ ){
        if( ans[i] != -1 )s.insert(ans[i]);
    }
    for( int i = n1 + 1; i <= n2 + n1; i++ ){
        for( auto x : v[i] ){
            if( ans[x] != -1 )s.erase(s.find(ans[x]));
        }
        if( s.empty() )ans[i] = -1;
        else ans[i] = b[i - n1] + *s.begin();
        for( auto x : v[i] ){
            if( ans[x] != -1 )s.insert(ans[x]);
        }
    }
    s.clear();
    for( int i = n1 + 1; i <= n1 + n2; i++ ){
        if( ans[i] != -1 )s.insert(ans[i]);
    }
    for( int i = 1; i <= n1; i++ ){
        for( auto x : v[i] ){
            if( ans[x] != -1 )s.erase(s.find(ans[x]));
        }
        if( s.empty() )ans[i] = -1;
        else ans[i] = a[i] + *s.begin();
        for( auto x : v[i] ){
            if( ans[x] != -1 )s.insert(ans[x]);
        }
    }
    int res = 1e9;
    for( int i = 1; i <= n1; i++ ){
        if( ans[i] != -1 )res = min( res , ans[i] );
    }
    if( res == 1e9 )res = -1;
    cout << res;
}

int main()
{
    ios_base::sync_with_stdio(0);
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

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