Being a space captain is dangerous work, especially on a mission inside Borg space. Today your captain must beam aboard a Borg ship and look for anything useful.
The ship is a set of rooms joined by passages of equal length. There is at most one passage directly between any two rooms, and it is possible to travel from any room to any other room, so the ship forms a single connected graph.
A sentry, left aboard by the Borg long ago, patrols the ship by walking at random: once every minute it picks one of the rooms adjacent to its current room, each with equal probability, and moves there. Because it has been wandering for so long, at the instant the captain beams aboard its position is random — the probability that it is in a given room is proportional to the number of passages leaving that room (that room's number of neighbours).
Star Fleet has ordered the captain to visit a fixed sequence of rooms, in exactly that order. This sequence is a walk on the ship: consecutive rooms are joined by a passage, and a room may be visited several times. The captain spends exactly one minute in each room, and you time his moves so that he and the sentry step at exactly the same moment.
The captain is caught if and only if, after a simultaneous step, the two of them are in the same room, or they swap rooms (he moves into the room the sentry just left while the sentry moves into the room he just left). The captain is beamed down to the first room of the walk and beamed back up from the last room; he risks capture in both of these rooms as well.
Compute the probability that the captain completes the whole walk without ever being caught.
The first line contains an integer $N$ ($2 \le N \le 500$), the number of rooms.
The second line contains an integer $L$ ($1 \le L \le 500$), the number of rooms the captain must visit.
The third line contains $L$ integers: the rooms of the captain's walk, in order (rooms are numbered from $0$).
Each of the next $N$ lines describes one room. Line $i$ (for room $i$, $0$-indexed) begins with an integer $n_i$, the number of neighbours of room $i$, followed by the $n_i$ room numbers of those neighbours.
Print the probability that the captain finishes the mission without ever being discovered by the sentry, rounded to exactly $6$ digits after the decimal point (for example, 0.500000).