//To debug :  g++ -g file.cpp -o code
//to flush output : fflush(stdout) or cout.flush()
//cout<<setprecision(p)<<fixed<<var
//use 1LL<<i to for 64 bit shifting , (ll)2 because by default 2 is ll
//take care of precedence rule of operators 
//do not forget to change the sizes of arrays and value of contants and other things after debugging  
 
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 ll_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 ll_MIN
#define sma3 -1000000000
#define mp make_pair
#define dub double
#define ivec vector<ll>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define mt make_tuple
#define MOD 998244353
#define ld long double
#define pi acos(-1.0)
 
#define SZ(x)  (ll)(x.size())
 
//comment the below if not required
 
/*
 
#define ss second.second
#define ff first.first
#define f first
#define s second
#define sf second.first
#define fs first.second
*/
 
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
 
//cout<<"Case #"<<c<<": "<<ans<<"\n" ;

const ll N = 150001;

ll a[5][N],n[5],x,y,temp,val,i,j,ans=LLONG_MAX;

set<pair<ll,ll>> m;

vector<ll> v[5][N];

int main()
{
	IOS;

	rep(i,1,5)
		cin>>n[i];

	rep(i,1,5)
		rep(j,1,n[i]+1)
			cin>>a[i][j];

	rep(i,1,4)
	{
		cin>>val;

		rep(j,1,val+1)
		{
			cin>>x>>y;
			v[i+1][y].pb(x);
		}

	}

	rep(i,2,5)
	{
		m.clear();

		rep(j,1,n[i-1]+1)
		{
			if(a[i-1][j]!=-1)
				m.insert({a[i-1][j],j});
		}

		rep(j,1,n[i]+1)
		{
			for(auto u : v[i][j])
			{
				if(a[i-1][u]!=-1)
				{
					auto it = m.find({a[i-1][u],u});
					m.erase(it);
				}
			}

			if(SZ(m))
			{
				auto it = m.begin();
				a[i][j]+=(*it).first;
			}
			else
				a[i][j]=-1;

			for(auto u : v[i][j])
			{
				if(a[i-1][u]!=-1)
					m.insert({a[i-1][u],u});
			}

		}

	}


	rep(i,1,n[4]+1){

		if(a[4][i]==-1)
			continue;

		ans = min(ans,a[4][i]);
	}

	if(ans==LLONG_MAX)
		ans = -1;

	cout<<ans<<"\n";


	return 0;
}