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

int n[4];
int m[4];
vector<int> meals[4];
vector<vector<int>> badTogether[4];

int dp[4][150005];//dp[i][j] = minimum cost of dinner of first i meals, ending with meals[i][j]

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

    cin >> n[0] >> n[1] >> n[2] >> n[3];
    for(int i = 0; i < 4; ++i){
        for(int j = 0; j < n[i]; ++j){
            int x;
            cin >> x;
            meals[i].push_back(x);
        }
    }
    for(int j = 1; j < 4; ++j){
        cin >> m[j];
        badTogether[j].resize(n[j]);
        for(int i = 0; i < m[j]; ++i){
            int x, y;
            cin >> x >> y;--x;--y;
            badTogether[j][y].push_back(x);
        }
    }
    for(int i = 0; i < n[0]; ++i)
        dp[0][i] = meals[0][i];

    for(int j = 1; j < 4; ++j){
        multiset<int> s;
        for(int i = 0; i < n[j - 1]; ++i)
            if(dp[j - 1][i] != INT_MAX)
                s.insert(dp[j - 1][i]); //s filled with perv meal prefixes

        for(int i = 0; i < n[j]; ++i){ //for every ending
            for(auto x : badTogether[j][i]){
                auto er = s.find(dp[j - 1][x]);
                if(er != s.end())
                    s.erase(er); //erase all bad for this ending meal
            }

            if(s.empty()){
                dp[j][i] = INT_MAX;
            }else{
                dp[j][i] = meals[j][i] + *(s.begin());
            }

            for(auto x : badTogether[j][i]){
                if(dp[j - 1][x] != INT_MAX)
                    s.insert(dp[j - 1][x]); //return all bad for this ending meal
            }
        }
    }

    int mn = INT_MAX;
    for(int i = 0; i < n[3]; ++i){
        mn = min(mn, dp[3][i]);
    }

    cout << (mn == INT_MAX ? -1 : mn) << "\n";
    return 0;
}
