Shortest even path#10082

Shortest even path

2 secondi
128 megabyte
Molto facile

Undirected unweighted graph is given. Find the shortest path between two vertices of even length.

Input

The first line contains four integers: number of vertices , number of edges (n, m \le 10^5), source and destination (1 \le s, d \le n). Each of the next lines contains two integers and describing an undirected edge .

Output

Print the shortest distance from to . The length of the path (number of edges in the path) must be even. If there is no path of even length between and , print .

Esempi

Esempio 1

Loading
Loading

Esempio 2

Loading
Loading