The metro system consists of stations arranged along lines. Each station belongs to one or more lines (in this case, at that station you can transfer to any of the lines passing through it). Each line contains at least two stations and intersects with at least one other line. The metro system is connected.
Travel between two adjacent stations on the same line is possible in both directions and takes minutes. Transferring from one line to another at the same station takes minute. Other travel times can be neglected.
Determine the minimum time required for the manager of the company "Diez-Product" to travel from station on line to station on line .
The first line contains two positive integers and (1 \leq l \leq 10). Each of the next lines lists the consecutive station numbers for each metro line. The last line contains the initial and destination stations and their lines. All numbers do not exceed .
Print the minimum travel time between the specified stations.
In the following example, it is required to find the shortest route from station on line to station on line .
Travel along line from station to station : minutes.
Transfer at station from line to line : minute.
Travel along line from station to station : minutes.
Transfer at station from line to line : minute.
Travel along line from station to station : minutes.
The total travel time is 2 + 1 + 4 + 1 + 2 = 10 minutes.

Example 1