#include <bits/stdc++.h>
using namespace std;
const int mxn = 131072, inf = 0x3f3f3f3f;
int N, M, S, T, dst, ans, head[mxn], dis[mxn], exist[mxn], q[mxn];
struct ed {
  int to, nxt, val, fee;
} edge[mxn << 1];
void add(int u, int v, int w, int f) {
  edge[++M] = (ed){v, head[u], w, f}, head[u] = M;
}
void addedge(int u, int v, int w, int f) { add(u, v, w, f), add(v, u, 0, -f); }
int dfs(int u, int mx) {
  if (u == T) return ans += dst * mx, mx;
  exist[u] = 1;
  int num = 0, i, v, f;
  for (int i = head[u]; i; i = edge[i].nxt)
    if (!edge[i].fee && !exist[v = edge[i].to] && (f = edge[i].val))
      if (edge[i].val -= (f = dfs(v, min(mx - num, f))), edge[i ^ 1].val += f,
          (num += f) == mx)
        return exist[u] = 0, num;
  return num;
}
bool mdf() {
  memset(exist, 0, sizeof(exist)), memset(dis, 0x3f, sizeof(dis)),
      dis[q[1] = T] = 0;
  for (int hd = 0, tail = 1, i, u, v; hd != tail;)
    for (i = head[u = q[hd = hd % N + 1]], exist[u] = 0; i; i = edge[i].nxt)
      if (edge[i ^ 1].val && dis[v = edge[i].to] > dis[u] - edge[i].fee)
        if (dis[v] = dis[u] - edge[i].fee, !exist[v] && (exist[v] = 1))
          if (hd != tail && dis[v] < dis[q[hd + 1]])
            q[hd] = v, hd += (hd < 2) * N - 1;
          else
            q[tail = tail % N + 1] = v;
  for (int u = 1; u <= N; ++u)
    for (int i = head[u]; i; i = edge[i].nxt)
      edge[i].fee -= dis[u] - dis[edge[i].to];
  return dst += dis[S], dis[S] < inf;
}
int n, m, rx, ry, a[mxn], hd[mxn], stk[mxn], tp;
struct e {
  int to, nxt;
} edg[mxn << 1];
void addedg(int u, int v) { edg[++m] = (e){v, hd[u]}, hd[u] = m; }
int dfss(int u, int fa, int sum = 0) {
  for (int i = hd[stk[++tp] = u], v; i; i = edg[i].nxt)
    if ((v = edg[i].to) != fa) sum += dfss(v, u);
  if (a[u] == -1 || (sum > a[u] && (ans = 1))) return sum;
  if (u <= n)
    addedge(S, ++N, a[u] - sum, 0);
  else
    addedge(++N, T, a[u] - sum, 0);
  for (; stk[tp + 1] != u;)
    if (u <= n)
      addedge(N, stk[tp--], 1, 0);
    else
      addedge(stk[tp--], N, 1, 0);
  return a[u];
}
int main() {
  scanf("%d%d%d", &n, &rx, &ry), M = 1, S = n << 1 | 1, T = N = n * 2 + 2;
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= n; ++i) addedge(i, i + n, 1, -a[i]);
  memset(a, -1, sizeof(a));
  for (int i = 1, x, y; i < n; ++i)
    scanf("%d%d", &x, &y), addedg(x, y), addedg(y, x);
  for (int i = 1, x, y; i < n; ++i)
    scanf("%d%d", &x, &y), addedg(x + n, y + n), addedg(y + n, x + n);
  for (int i = (scanf("%d", &m), 1), x, y; i <= m; ++i)
    scanf("%d%d", &x, &y), a[x] = y;
  for (int i = (scanf("%d", &m), 1), x, y; i <= m; ++i)
    scanf("%d%d", &x, &y), a[x + n] = y;
  if (dfss(rx, 0), dfss(ry + n, 0), ans) return puts("-1"), 0;
  for (; mdf(); memset(exist, 0, sizeof(exist)), dfs(S, inf))
    ;
  for (int i = 2; i <= M; ++i)
    if (edge[i ^ 1].to == S && edge[i].val) return puts("-1"), 0;
  for (int i = 2; i <= M; ++i)
    if (edge[i].to == T && edge[i].val) return puts("-1"), 0;
  return printf("%d\n", -ans), 0;
}
