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:
//#pragma GCC optimize ("O3")
//#pragma GCC target ("avx")
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}

double dist(double x,double y){
	return sqrt(x*x+y*y);
}

vector<int> g[100100];
int d[100100];
int dd[100100];
bool is_not_prime[1000100];

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n,m,s,t; cin >> n >> m >> s >> t;
	for(int i=0;i<n;i++){
		d[i]=dd[i]=1e9;
	}
	s--; t--;
	d[s]=0;
	dd[t]=0;
	while(m--){
		int x,y; cin >> x >> y;
		x--; y--;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	for(int to:g[s]){
		for(int toto:g[to]){
			if(toto==t){
				printf("2\n");
				return 0;
			}
		}
	}
	queue<int> q;
	q.push(s);
	while(q.size()){
		int p=q.front(); q.pop();
		for(int to:g[p]){
			if(d[to]!=1e9)continue;
			d[to]=d[p]+1;
			q.push(to);
		}
	}
	q.push(t);
	while(q.size()){
		int p=q.front(); q.pop();
		for(int to:g[p]){
			if(dd[to]!=1e9)continue;
			dd[to]=dd[p]+1;
			q.push(to);
		}
	}
	const int N=1000100;
	vector<int> prime;
	for(int i=2;i<N;i++){
		if(!is_not_prime[i]){
			if(i!=2)prime.push_back(i);
			for(int j=i+i;j<N;j+=i){
				is_not_prime[j]=true;
			}
		}
	}
	if(d[t]%2){
		printf("%d\n",*lower_bound(prime.begin(), prime.end(),d[t]));
		return 0;
	}
	else{
		int res=1e9;
		for(int i=0;i<n;i++){
			for(int to:g[i]){
				if((d[i]+1+dd[to])%2){
					res=min(res,*lower_bound(prime.begin(), prime.end(),d[i]+dd[to]+1));
				}
			}
		}
		if(res==1e9)res=-1;
		printf("%d\n",res);
	}
}