#include <bits/stdc++.h>
using namespace std;
#define int ll
using ll = long long;
using db = long double;
using pi = pair<int, int>;
using mi = map<int, int>;
#define fi first
#define se second
#define vt vector
#define sz size()
#define mp make_pair
#define eb emplace_back
#define endl '\n'
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define per(i, l, r) for (int i = l; i >= r; i--)
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
ll qpow(ll a,ll b,ll MOD=mod){for(ll ans=1;;a=a*a%MOD,b>>=1){if(b&1)ans=ans*a%MOD;if(!b)return ans;}}
ll inv(ll a,ll MOD=mod){return qpow(a,MOD-2,MOD);}//要求MOD为质数
ll exgcd(ll a,ll b,ll &x,ll &y){if(b==0){x=1,y=0;return a;}ll ret=exgcd(b,a%b,y,x);y-=a/b*x;return ret;}
ll getInv(int a,int mod){ll x,y;ll d=exgcd(a,mod,x,y);return d==1?(x%mod+mod)%mod:-1;}//求a在mod下的逆元，不存在逆元返回-1，不要求MOD为质数

using vi = vt<int>;
const int N = 4e5 + 5;
int  M = 1e9 + 7;

inline int add(int x, int y) { return x + y >= M ? x + y - M : x + y; }
inline int mul(int x, int y) { return x * y % M; }
inline int sub(int x, int y) { return x - y < 0 ? x - y + M : x - y; }


using G = vt<vi>;

#define mid (l+r>>1)
#define lc p<<1
#define rc lc|1
#define lson lc,l,mid
#define rson rc,mid+1,r
signed main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n1,n2,n3,n4;
    cin >> n1 >> n2 >> n3 >> n4;
    vector<int>a(n1);
    vector<pair<int, int>>sa(n1);
    vector<int>b(n2);
    vector<int>c(n3);
    vector<int>d(n4);
    int i = 0;
    for(int &x : a)
    {
        cin >> x;
        sa[i].fi = x, sa[i].se = i;
        i++;
    }
    sort(all(sa));
    for(int i = 0; i < n1; i++)
    {
        a[sa[i].se] = i;
    }
    for(int &x : b)
    {
        cin >> x;
    }
    for(int &x : c)
    {
        cin >> x;
    }
    for(int &x : d)
    {
        cin >> x;
    }
    vector<vector<int>>g1(n2);
    int m1;
    cin >> m1;
    for(int i = 1; i <= m1; i++)
    {

        int x, y;
        cin >> x >> y;
        x--,y--;
        g1[y].push_back(a[x]);
    }
   //vector<int>vis2(n1, 1);
    for(int i = 0; i < n2; i++)
    {
        if(g1[i].size() == 0)
        {
            b[i] += sa[0].fi;
        }
        else
        {
            sort(all(g1[i]));
            int tmp = 0;
            if(g1[i].sz == n1)
            {
                b[i] += 1e18;
                //vis2[i] = 0;
                continue;
            }
            for(int j = 0; j < g1[i].sz; j++)
            {
                if(g1[i][j] != j)
                {
                    b[i] += sa[j].fi;
                    tmp = 1;
                    break;
                }
            }
            if(!tmp)
            {
                b[i] += sa[g1[i].sz].fi;
            }
        }
    }
    i = 0;
//    for(int i = 0; i < n2; i++)
//    {
//        cout << b[i] << " \n"[i == n2 - 1];
//    }
    ////////////////////////////////
    vector<pair<int, int>>sb(n2);
     i = 0;
    for(int &x : b)
    {
        //cin >> x;
        sb[i].fi = x, sb[i].se = i;
        i++;
    }
    sort(all(sb));
    for(int i = 0; i < n2; i++)
    {
        b[sb[i].se] = i;
    }
     vector<vector<int>>g2(n3);
    int m2;
    cin >> m2;
    for(int i = 1; i <= m2; i++)
    {
        int x, y;
        cin >> x >> y;
        x--,y--;
        g2[y].push_back(b[x]);
    }
      for(int i = 0; i < n3; i++)
    {
        if(g2[i].size() == 0)
        {
            c[i] += sb[0].fi;
        }
        else
        {
            sort(all(g2[i]));
            int tmp = 0;
            if(g2[i].sz == n2)
            {
                c[i] += 1e18;
                //vis2[i] = 0;
                continue;
            }
            for(int j = 0; j < g2[i].sz; j++)
            {
               // cout <<"sm=" << i << ' ' << j << ' ' << g2[i][j] << endl;
                if(g2[i][j] != j)
                {
                    c[i] += sb[j].fi;
                    tmp = 1;
                    break;
                }
            }
            if(!tmp)
            {
                c[i] += sb[g2[i].sz].fi;
            }
        }
    }
//    for(int i = 0; i < n3; i++)
//    {
//        cout << c[i] << " \n"[i == n3 - 1];
//    }
    ///////
     vector<pair<int, int>>sc(n3);
     i = 0;
    for(int &x : c)
    {
        //cin >> x;
        sc[i].fi = x, sc[i].se = i;
        i++;
    }
    sort(all(sc));
    for(int i = 0; i < n3; i++)
    {
        c[sc[i].se] = i;
    }
     vector<vector<int>>g3(n4);
    int ans = 1e18;
    int m3;
    cin >> m3;
    for(int i = 1; i <= m3; i++)
    {
        int x, y;
        cin >> x >> y;
        x--,y--;
        g3[y].push_back(c[x]);
      //  cout << x << ' ' << y << endl;
    }
      for(int i = 0; i < n4; i++)
    {
      //  cout << i << endl;
        if(g3[i].size() == 0)
        {
            d[i] += sc[0].fi;
            ans = min(ans, d[i]);
        }
        else
        {
            //cout << "g" << endl;
          //  cout << "S = " << g3[i].sz << endl;
            sort(all(g3[i]));
            int tmp = 0;
            if(g3[i].sz == n3)
            {
                d[i] += 1e18;
                //vis2[i] = 0;
                continue;
            }
            for(int j = 0; j < g3[i].sz; j++)
            {
             //   cout << "j= " << j << endl;
                if(g3[i][j] != j)
                {
                    d[i] += sc[j].fi;
                    tmp = 1;
                    ans = min(ans, d[i]);
                    break;
                }
            }
            if(!tmp)
            {
                d[i] += sc[g3[i].sz].fi;
                ans = min(ans, d[i]);
            }
        }
       // cout << ans << endl;
    }
    if(ans >= 1e18) cout << -1 << endl;
    else cout << ans << endl;
    ///////

}
