#D205. Prime Routing
Prime Routing
Prime Routing
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 computers, which are connected by cables. The -th cable connects the -th computer and the -th computer, and it carries data in both directions. Your team will use the -th computer in the contest, and a judge server is the -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 to needed to pass through the cables. If the number of times a packet passes through the cables cannot be a prime number, print .
Input
The input consists of a single test case, formatted as follows.
The first line consists of four integers and ($2 \leq N \leq 10^5, 1 \leq M \leq 10^5, 1 \leq S, T \leq N, S \ne T$). The -th line of the following lines consists of two integers and (), which means the -th cables connects the -th computer and the -th computer in the network. You can assume that the network satisfies the following conditions.
- The network has no multi-edge, i.e., for all ().
- The packets from computers are reachable to 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 to passes through the cables is a prime number, print the minimum prime number of times in one line. Otherwise, print .
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
inputFormat
Input
The input consists of a single test case, formatted as follows.
The first line consists of four integers and ($2 \leq N \leq 10^5, 1 \leq M \leq 10^5, 1 \leq S, T \leq N, S \ne T$). The -th line of the following lines consists of two integers and (), which means the -th cables connects the -th computer and the -th computer in the network. You can assume that the network satisfies the following conditions.
- The network has no multi-edge, i.e., for all ().
- The packets from computers are reachable to by passing through some number of cables. The number is not necessarily a prime.
outputFormat
Output
If there are ways such that the number of times a packet sent from to passes through the cables is a prime number, print the minimum prime number of times in one line. Otherwise, print .
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
样例
2 1 1 2
1 2
3