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<bits/stdc++.h>

using namespace std;
#define REPP(i,a,b,c) for(int i=a; i<=b; i+=c)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,c) for(int i=a; i>=b; i-=c)
#define REV(i,a,b) REVV(i,a,b,1)
#define FOR(i,a) REP(i,0,(int)a-1)
#define FORD(i,a) REV(i,(int)a-1,0)
#define PB push_back
#define POB pop_back
#define FI first
#define SE second
#define MP make_pair
typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef vector < int > vi;
typedef vector < pii > vii;
typedef vector < ll > vl;
typedef pair < ll , ll > pll;
typedef vector < pll > vll;

const ll MOD = 1e9 + 7;
const double EPS = 1e-9;
const int INF = 1e9;

ll addMod(ll a, ll b){
	if(a + b >= MOD) return a + b - MOD;
	return a + b;
}

ll mulMod(ll a, ll b){
	return (a*b)%MOD;
}

ll fast(ll a, ll b){
	if(b == 0) return 1;
	ll tmp = fast(a,b/2);
	tmp = mulMod(tmp,tmp);
	if(b & 1) tmp = mulMod(tmp,a);
	return tmp;
}

ll GCD(ll a, ll b){
	if(a > b) return GCD(b,a);
	if(a == 0) return b;
	return GCD(b%a,a);
}

//////////////////////////////////////////////

const int N = 1e5;

vi G[N + 5];
int vis[N + 5][3];
int n,m,st,en;
vi pr;
bool flag[10*N + 5];

void gprime(){
	int MX = 10*N;
	REP(i,2,MX){
		if(flag[i]) continue;
		pr.PB(i);
		REP(j,i,MX/i){
			flag[j*i] = true;
		}
	}
}

int find(int v){
	int l = 0, r = (int)pr.size()-1, mid, ret = -1;
	while(l <= r){
		mid = (l + r) / 2;
		if(pr[mid] >= v){
			r = mid - 1;
			ret = mid;
		}
		else l = mid + 1;
	}
	return ret;
}

int solve(){
	queue< pii > pq;
	pq.push(MP(0,st));
	int now, step, nxt, ret = INF, v;
	while(!pq.empty()){
		now = pq.front().SE;
		step = pq.front().FI;
		pq.pop();
		if(now == en){
			v = find(step);
			if(v != -1 && (pr[v] - step) % 2 == 0) ret = min(ret,pr[v]);
			else if(v+1 < (int)pr.size() && (pr[v+1] - step) % 2 == 0) ret = min(ret, pr[v+1]);
		}
		if(vis[now][step%2] || step > 3*N) continue;
		vis[now][step%2] = true;
		FOR(i,G[now].size()){
			nxt = G[now][i];
			if(!vis[nxt][(step+1)%2]){
				pq.push(MP((step+1), nxt)); 
			}
		}
	}
	if(ret == INF) ret = -1;
	return ret;
}

int main(){
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	memset(flag,0,sizeof flag);
	memset(vis,0,sizeof vis);
	gprime();
	cin >> n >> m >> st >> en;
	int u,v;
	FOR(i,m){
		cin >> u >> v;
		G[u].PB(v);
		G[v].PB(u);
	}
	
	cout << solve() << endl;
	return 0;
}