#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1.5e5+5;
int n[5];
int a[5][N];
int f[5][N];
vector<int>g[N];

int main(){
    ios::sync_with_stdio(false),cin.tie(0);
    for(int i=1;i<5;++i)cin>>n[i];
    
    for(int i=1;i<5;++i)
     for(int j=1;j<=n[i];++j)cin>>a[i][j];
    memset(f,0x3f,sizeof(f));
    int ans=0x3f3f3f3f;
    multiset<int>s;
    for(int i=1;i<=n[1];++i)f[1][i]=a[1][i];//
    for(int i=2;i<5;++i){
        int num;
        cin>>num;
        for(int j=1;j<=n[i];++j)g[j].clear();
        s.clear();
        for(int j=1;j<=num;++j){
            int x,y;
            cin>>x>>y;
            g[y].push_back(x);
        }
        for(int j=1;j<=n[i-1];++j)s.insert(f[i-1][j]);
        for(int j=1;j<=n[i];++j){
            for(auto x:g[j])s.erase(s.find(f[i-1][x]));
            if(s.begin()!=s.end()) f[i][j]=*s.begin()+a[i][j];
            if(i==4)ans=min(ans,f[i][j]);
            for(auto x:g[j])s.insert(f[i-1][x]);
        }
        
    }
    cout<<(ans==0x3f3f3f3f?-1:ans);
    return 0;
}
