Task
Valerio is robbing a bank, but an alarm started ringing as he was trying to break into the caveau.
He needs to get out as fast as possible through the twisted sewer tunnels running nearby the bank.
The police is already looking for him and has sent patrols, indexed from to to guard the manholes connected to the sewer system.
There are manholes, indexed from to and tunnels connecting pairs of them. Valerio's friend Filippo is waiting for him nearby manhole , if he can reach it, he will escape safely.
Valerio starts from manhole and, every minute, he can choose to move to a manhole adjacent to the one he is in or to stay another minute under the same manhole.
Each police patrol guard manholes, indexed from to . Patrol is initially guarding manhole , every minute it moves from manhole to manhole , after reaching manhole , it return to manhole .
Input
The first line contains three integers , and , the numbers of manholes, tunnels and patrols respectively. (), (), ().
The following lines contain two integers each: the manholes connected by tunnel .
The following lines contain the integer followed by integers . ().
Restrictions
- For tests worth points, (, , ).
- For tests worth more points, ().
- For tests worth more points () for .
Output
You need to write a single line with an integer: the minimum amount of minutes needed to get from manhole to manhole , or if it is impossible to do.
Example 1
stdin
3 2 1
0 1
1 2
3 1 2 0
stdout
2
Example 2
stdin
5 4 3
0 1
1 2
2 3
3 4
3 4 2 3
2 2 1
2 4 3
stdout
5
Explanation
In the first sample case Valerio is beneath manhole , and there is a single patrol watching manhole .
In the first minute Valerio moves to manhole while the patrol moves to manhole .
In the second minute Valerio moves to manhole while the patrol moves to manhole , making it out safely in minutes.
In the second sample case it takes Valerio minutes to escape while avoiding the patrols.