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

#define ll long long
#define mem(a, b) memset(a,b,sizeof(a))
#define sz(a) (int)a.size()
#define INF 0x3f3f3f3f
#define DNF 0x7f
#define DBG printf("this is a input\n")
#define fi first
#define se second
#define pii pair<int,int>
#define mk(a, b) make_pair(a,b)
#define pb push_back
#define LF putchar('\n')
#define SP putchar(' ')
#define p_queue priority_queue
#define CLOSE ios::sync_with_stdio(0); cin.tie(0)

template<typename T>
void read(T &x) {x = 0;char ch = getchar();ll f = 1;while(!isdigit(ch)){if(ch == '-')f *= -1;ch = getchar();}while(isdigit(ch)){x = x * 10 + ch - 48; ch = getchar();}x *= f;}
template<typename T, typename... Args>
void read(T &first, Args& ... args) {read(first);read(args...);}
template<typename T>
void write(T arg) {T x = arg;if(x < 0) {putchar('-'); x =- x;}if(x > 9) {write(x / 10);}putchar(x % 10 + '0');}
template<typename T, typename ... Ts>
void write(T arg, Ts ... args) {write(arg);if(sizeof...(args) != 0) {putchar(' ');write(args ...);}}
using namespace std;

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}


const int N = 150005;
int n[5], m;
ll dp[5][N];
struct node {
    ll idx, val;
}w[5][N];;
bool cmp (node x, node y)
{
    return x.val < y.val;
}

vector <ll> mark;

int main (void)
{
    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 ("%lld", &w[i][j].val), w[i][j].idx = j;
            dp[i][j] = INF;
        }
        w[i][n[i]+1].val = INF;
    }
    for (int i = 2 ; i <= 4 ; i ++)
    {
        set <int> s[N];
        sort (w[i-1] + 1, w[i-1] + n[i-1] + 1, cmp);
        scanf ("%d",&m);
        for (int j = 1; j <= m ; j ++)
        {
            int u , v;
            scanf ("%d %d",&u, &v);
            s[v].insert(u);
        }
        for (int j = 1 ; j <= n[i] ; j ++)
        {
            for (int k = 1 ; k <= n[i-1] + 1; k ++)
            {
                if (s[j].find(w[i-1][k].idx) == s[j].end())
                {
                    w[i][j].val += w[i - 1][k].val;
                    break;
                }
            }
        }
    }
    ll ans = INF;
    for (int i = 1 ; i <= n[4] ; i ++)
        ans = min (ans, w[4][i].val);
    if (ans >= INF)
        ans = -1;
    printf ("%lld\n", ans);
}
/*
5
1 2 5 1 4
1 2
1 3
2 4
2 5
 */