#include<bits/stdc++.h>
#define NN 200100
#define inf 0x3f3f3f3f

using namespace std;
using INT=long long;
using pii = pair<int, int>;

int a[NN], b[NN], c[NN], d[NN];
vector<int>A[NN], B[NN], C[NN];
pii p[NN];
int id[NN];

void solve(int n, int cost[], int m, int *tmp, vector<int>vec[]) {
	for(int i = 1; i <= n; i ++) p[i] = pii(cost[i], i);
	sort(p + 1, p + n + 1);
	sort(cost + 1, cost + n + 1);
	for(int i = 1; i <= n; i ++) id[p[i].second] = i;
	for(int i = 1; i <= m; i ++) {
		for(int j = 0; j < vec[i].size(); j ++) {
			int u = vec[i][j];
			vec[i][j] = id[u];
		}
		sort(vec[i].begin(), vec[i].end());
		int pos = 1, nn = 0, flag = 0;
		while(pos <= n && nn < (int) vec[i].size()) {
			int u = vec[i][nn];
			if(u != pos) {
				tmp[i] += cost[pos];
				tmp[i] = min(tmp[i], inf);
				flag = 1;
				break;
			}
			pos++, nn ++;
		}
		if(!flag) {
			if(pos <= n) {
				tmp[i] += cost[pos];
				tmp[i] = min(tmp[i], inf);
			}
			else tmp[i] = inf;
		}
	}
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	int n1, n2, n3, n4;
	cin >> n1 >> n2 >> n3 >> n4;
	for(int i = 1; i <= n1; i ++) scanf("%d", &a[i]);
	for(int i = 1; i <= n2; i ++) scanf("%d", &b[i]);
	for(int i = 1; i <= n3; i ++) scanf("%d", &c[i]);
	for(int i = 1; i <= n4; i ++) scanf("%d", &d[i]);
	int m1;
	cin >> m1;
	for(int i = 1; i <= m1; i ++) {
		int u, v;
		scanf("%d %d", &u, &v);
		A[u].push_back(v);
	}
	int m2;
	cin >> m2;
	for(int i = 1; i <= m2; i ++) {
		int u, v;
		scanf("%d %d", &u, &v);
		B[u].push_back(v);
	}
	int m3;
	cin >> m3;
	for(int i = 1; i <= m3; i ++) {
		int u, v;
		scanf("%d %d", &u, &v);
		C[u].push_back(v);
	}
	solve(n4, d, n3, c, C);
	solve(n3, c, n2, b, B);
	solve(n2, b, n1, a, A);
	int ans = inf;
	for(int i = 1; i <= n1; i ++) ans = min(ans, a[i]);
	if(ans >= inf) ans = -1;
	cout << ans << endl;
	
}
                