#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2, class T3 = hash<T1>>
using umap = unordered_map<T1, T2, T3>;
template <class T>
using uset = unordered_set<T>;
template <class T>
using vec = vector<T>;
const long long infll = numeric_limits<long long>::max() >> 1;
const int inf = numeric_limits<int>::max() >> 1;
const int N = 101;
int n, m, k, s, t;
int opt[N][N];
bool sure[N][N];
vec<int> adj[N];
vec<int> rev[N];
vec<int> out[N][N];
struct Edge {
  int i, v, w;
};
struct Graph {
  int dst;
  vec<Edge> adj;
} graph[N][N];
void input() {
  cin >> n >> m >> s >> t;
  for (int i = 0; i < m; ++i) {
    int u;
    cin >> u;
    int v;
    cin >> v;
    adj[u].push_back(v);
    rev[v].push_back(u);
  }
}
void bfs(int source, int dst[N], vec<int> adj[N]) {
  fill(dst, dst + N, inf);
  queue<int> q;
  q.push(source);
  dst[source] = 0;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int v : adj[u]) {
      if (dst[v] > dst[u] + 1) {
        dst[v] = dst[u] + 1;
        q.push(v);
      }
    }
  }
}
void construct(int source, int sink, int index, vec<int> out[N]) {
  int dst_source[N];
  int dst_sink[N];
  int cnt[N] = {0};
  bfs(source, dst_source, adj);
  bfs(sink, dst_sink, rev);
  if (dst_source[sink] == inf) {
    return;
  }
  for (int u = 1; u <= n; ++u) {
    if (dst_source[u] + dst_sink[u] != dst_source[sink]) {
      continue;
    }
    if (dst_source[u] < inf) {
      cnt[dst_source[u]]++;
    }
  }
  for (int u = 1; u <= n; ++u) {
    if (dst_source[u] + dst_sink[u] != dst_source[sink]) {
      continue;
    }
    for (int v : adj[u]) {
      if (dst_source[v] + dst_sink[v] != dst_source[sink]) {
        continue;
      }
      if (dst_source[v] == dst_source[u] + 1) {
        out[u].push_back(v);
      }
    }
    if (cnt[dst_source[u]] == 1) {
      sure[index][u] = 1;
    }
  }
}
int bellman_ford() {
  for (int i = 0; i <= k; ++i) {
    for (int u = 1; u <= n; ++u) {
      if (u == t) {
        opt[i][u] = 0;
      } else {
        opt[i][u] = inf;
      }
    }
  }
  while (true) {
    bool changed = 0;
    for (int i = 0; i <= k; ++i) {
      for (int u = 1; u <= n; ++u) {
        int maxadj = -1;
        int origval = opt[i][u];
        for (int v : out[i][u]) {
          maxadj = max(maxadj, opt[i][v]);
        }
        if (maxadj == -1) {
          maxadj = inf;
        }
        opt[i][u] = min(opt[i][u], maxadj);
        for (int j = 0; j <= k; ++j) {
          if (sure[j][u]) {
            opt[i][u] = min(opt[i][u], opt[j][u] + 1);
          }
        }
        if (opt[i][u] != origval) {
          changed = 1;
        }
      }
    }
    if (!changed) {
      break;
    }
  }
  return opt[0][s];
}
void solve() {
  cin >> k;
  for (int i = 1; i <= k; ++i) {
    int x;
    cin >> x;
    int y;
    cin >> y;
    construct(x, y, i, out[i]);
  }
  int res = bellman_ford();
  if (res == inf) {
    cout << "-1\n";
  } else {
    cout << res << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  input();
  solve();
}
