Problem: Fox Jiro is one of the staffs of the ACM-ICPC 2018 Asia Yokohama Regional Contest and is responsible for designing the network for the venue of the contest. His network consists of $N$ computers, which are connected by $M$ cables. The $i$-th cable connects the $a_i$-th computer and the $b_i$-th computer, and it carries data in both directions. Your team will use the $S$-th computer in the contest, and a judge server is the $T$-th computer.

He decided to adjust the routing algorithm of the network to maximize the performance of the contestants through the magical power of prime numbers. In this algorithm, a packet (a unit of data carried by the network) is sent from your computer to the judge server passing through the cables a prime number of times if possible. If it is impossible, the contestants cannot benefit by the magical power of prime numbers. To accomplish this target, a packet is allowed to pass through the same cable multiple times.

You decided to write a program to calculate the minimum number of times a packet from $S$ to $T$ needed to pass through the cables. If the number of times a packet passes through the cables cannot be a prime number, print $-1$.



Input

The input consists of a single test case, formatted as follows.


$N$ $M$ $S$ $T$
$a_1$ $b_1$
$\vdots$
$a_M$ $b_M$


The first line consists of four integers $N, M, S,$ and $T$ ($2 \leq N \leq 10^5, 1 \leq M \leq 10^5, 1 \leq S, T \leq N, S \ne T$). The $i$-th line of the following $M$ lines consists of two integers $a_i$ and $b_i$ ($1 \leq a_i < b_i \leq N$), which means the $i$-th cables connects the $a_i$-th computer and the $b_i$-th computer in the network. You can assume that the network satisfies the following conditions.

* The network has no multi-edge, i.e.,$(a_i, b_i) \ne (a_j, b_j)$ for all $i,j$ ($1 \leq i < j \leq M$).
* The packets from $N$ computers are reachable to $T$ by passing through some number of cables. The number is not necessarily a prime.

Output

If there are ways such that the number of times a packet sent from $S$ to $T$ passes through the cables is a prime number, print the minimum prime number of times in one line. Otherwise, print $-1$.

Examples

Input

5 5 1 5
1 2
1 4
2 3
3 4
3 5


Output

3


Input

5 4 1 5
1 2
2 3
3 4
4 5


Output

-1


Input

2 1 1 2
1 2


Output

3


Input

3 3 1 2
1 2
1 3
2 3


Output

2

Solution (in CPP):

Solution:
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;


int bfs(int start, vector<int>& d, vector<vector<int>>& g) {
	d[start] = 0;
	int last = -1;
	queue<int> q;
	q.push(start);
	while (!q.empty()) {
		int cur = q.front();
		q.pop();
		last = cur;
		for (int next : g[cur]) {
			if (d[next] != -1) continue;
			d[next] = d[cur] + 1;
			q.push(next);
		}
	}
	return last;
}
vector<bool> isprime;

void eratos(int n) {
	isprime.resize(n + 1);
	for (int i = 0; i <= n; i++) {
		isprime[i] = true;
	}
	isprime[0] = false;
	isprime[1] = false;
	for (int i = 2; i * i <= n; i++) {
		if (isprime[i]) {
			int j = i + i;
			while (j <= n) {
				isprime[j] = false;
				j = j + i;
			}
		}
	}
}
int main()
{
    /*
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    */
	eratos(1000000);
    int n, m, s, t; scanf("%d %d %d %d", &n, &m, &s, &t); s--; t--;
	vector<vector<int>> g(n);
	for (int i = 0; i < m; i++) {
		int u, v; scanf("%d %d", &u, &v);
		u--; v--;
		g[u].emplace_back(v);
		g[v].emplace_back(u);
	}
	{
		vector<int> v1; for (auto e : g[s]) v1.emplace_back(e);
		vector<int> v2; for (auto e : g[t]) v2.emplace_back(e);
		sort(v2.begin(), v2.end());
		for (auto e : v1) {
			if (binary_search(v2.begin(), v2.end(), e)) {
				puts("2");
				return 0;
			}
		}
	}
	vector<int> pr; for (int i = 3; i < 1000000; i += 2) if (isprime[i]) pr.emplace_back(i);
	vector<int> ds(n, -1), dt(n, -1); bfs(s, ds, g); bfs(t, dt, g);
	if (ds[t] % 2 == 1) {
		int res = *lower_bound(pr.begin(), pr.end(), ds[t]);
		printf("%d\n", res);
	}
	else {
		int res = inf;
		for (int i = 0; i < n; i++) {
			int d = ds[i];
			for (auto e : g[i]) {
				if ((dt[e] + d + 1) & 1) {
					chmin(res, *lower_bound(pr.begin(), pr.end(), dt[e] + d + 1));
				}
			}
		}
		if (res == inf) puts("-1");
		else printf("%d\n", res);
	}
    return 0;
}