# include<bits/stdc++.h>

using namespace std;
# define l long long 
# define db double 
# define rep(i,a,b) for(l i=a;i<b;i++)
# define vi vector<l>
# define vvi vector<vi>
# define vsi vector<set<l> >
# define pb push_back
# define mp make_pair
# define ss second
# define ff first
# define pii pair<l,l>
# define trvi(v,it) for(vi::iterator it=v.begin();it!=v.end();++it)
# define read(a) freopen(a,"r",stdin)
# define write(a) freopen(a,"w",stdout)
# define io ios::sync_with_stdio(false)

template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ' ' << p.second << ')'; }

const bool MULTIPLE_TEST_CASES = false;

void printArray(vi &a, string s) {
	cout<<s<<"\n";
	for(auto elem: a) {
		cout<<elem<<" ";
	}
	cout<<s<<"\n";
}

const l MOD=1e9+7;
const l N=1e5+5;
const l INF=1e12;

void getNext(l n1, l n2, vi &dpa, vi &dpb, vi &a, vi &b) {
	vector<set<l> > avoidb(n2);
	l m;
	cin>>m;
	rep(i,0,m) {
		l u,v;
		cin>>u>>v;
		u--;
		v--;
		avoidb[v].insert(u);
	}
	multiset<l> s(dpa.begin(), dpa.end());
	for(int i=0;i<n2;i++) {
		for(auto elem: avoidb[i]) {
			s.erase(s.find(dpa[elem]));
		}
		if(s.size()==0 || *(s.begin())==INF) {
			dpb[i] = INF;
		} else {
			dpb[i] = b[i] + *(s.begin());
		}
		for(auto elem: avoidb[i]) {
			s.insert(dpa[elem]);
		}
	}

}

void solve() {
	l n1,n2,n3,n4;
	cin>>n1>>n2>>n3>>n4;
	vi a(n1), b(n2), c(n3), d(n4);
	rep(i,0,n1) {
		cin>>a[i];
	}
	rep(i,0,n2) {
		cin>>b[i];
	}
	rep(i,0,n3) {
		cin>>c[i];
	}
	rep(i,0,n4) {
		cin>>d[i];
	}
	
	// return;
	vi dpa(a);

	vi dpb(n2,INF);
	vi dpc(n3,INF);
	vi dpd(n4,INF);
	getNext(n1,n2,dpa,dpb,a,b);
	// return;
	getNext(n2,n3,dpb,dpc,b,c);
	getNext(n3,n4,dpc,dpd,c,d);
	l ans = *min_element(dpd.begin(), dpd.end());
	if(ans==INF) {
		ans = -1;
	}
	cout<<ans<<"\n";

	return;
}


int main(){
	io;
	int t=1;
	if (MULTIPLE_TEST_CASES) cin>>t;
	rep(i,0,t) {
		solve();
	}

	return 0;
}
