#ifndef Local
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("popcnt,abm,mmx,avx2")
#endif
#include <bits/stdc++.h>

using namespace std;

#define popCnt(x) (__builtin_popcountll(x))
#define sz(x) ((int)(x.size()))
#define all(v) begin(v), end(v)
#define rall(v) rbegin(v), rend(v)
#define rep(i, l, r) for (int i = l; i < r; ++i)
using Long = long long;
using Double = double;
using vi = vector<int>;

template <class U, class V>
istream& operator>>(istream& is, pair<U, V>& p) {
  is >> p.first >> p.second;
  return is;
}
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (auto& x : v) {
    is >> x;
  }
  return is;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (auto& x : v) {
    os << x << " ";
  }
  return os;
}
template <typename T, typename... Ts>
T min(const T& h1, const T& h2, const Ts&... tail) {
  return min(min(h1, h2), tail...);
}

template <typename T, typename... Ts>
T max(const T& h1, const T& h2, const Ts&... tail) {
  return max(max(h1, h2), tail...);
}

const int N = 4;
const int OO = INT_MAX / 2;
int n[4];
using Graph = vector<vector<int>>;

vector<int> solve(const vector<int>& v1, const vector<int>& v2,
                  const Graph& adj) {
  multiset<int> ms(all(v1));
  ms.emplace(OO);
  vector<int> res(sz(v2));
  for (int i = 0; i < sz(res); ++i) {
    for (int j : adj[i]) {
      ms.erase(ms.find(v1[j]));
    }

    res[i] = min(OO, *ms.begin() + v2[i]);

    for (int j : adj[i]) {
      ms.emplace(v1[j]);
    }
  }
  return res;
}

Graph input(int n, bool rev) {
  int m;
  cin >> m;
  Graph res(n);
  while (m--) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    if (rev) {
      res[y].emplace_back(x);
    } else {
      res[x].emplace_back(y);
    }
  }
  return res;
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef Local
  freopen("test.in", "r", stdin);
  freopen("test.out", "w", stdout);
#else
#define endl '\n'
#endif

  for (int i = 0; i < 4; ++i) {
    cin >> n[i];
  }

  array<vector<int>, 4> v;
  for (int i = 0; i < 4; ++i) {
    v[i].resize(n[i]);
    for (int j = 0; j < n[i]; ++j) {
      int x;
      cin >> x;
      v[i][j] = x;
    }
  }

  Graph g10 = input(n[1], true);
  Graph g12 = input(n[1], false);
  Graph g23 = input(n[2], false);

  auto res10 = solve(v[0], v[1], g10);
  auto res23 = solve(v[3], v[2], g23);
  auto res_all = solve(res23, res10, g12);

  int res = *min_element(all(res_all));
  if (res == OO) {
    res = -1;
  }
  cout << res << endl;

  return 0;
}