Zulu loves to play football in Hackerland Football League. There are a total of N teams in the tournament. Zulu's team number is 1 and are called “Vikings”.
The tournament officials have given an ordered set of K teams against which Vikings definitely have to play in the tournament. Let the teams in the ordered set be T1,T2,....,TK so the Vikings need to ensure that they play against these teams in the given order (T1 first, then T2 and so on with team TK at last).
Now, there are certain rules which they have to obey in order to ensure successful participation in the tournament:
They cannot play a team more than once.
After they have played against the last team(TK) from the given ordered set, the tournament gets over.
The Vikings can play against other teams which are not in the ordered set as well as long as they obey the above rules. So, in other words if a subsequence from the list of teams Vikings have played against becomes equal with the given ordered set of K teams, the task has been achieved.
Initially, The Vikings has been provided with the list of teams from which they can choose their opposition with equal probability to play against. After each match, they get a list of teams they can play against (Let’s say there are X teams in the list and they have already played against Y teams, then they can pick their opposition from remaining X−Y teams with equal probability) and this continues until they play against TK after which tournament gets over or they have played against all the teams in the list and cannot play more matches.
Now, there are many ways through which The Vikings can ensure successful participation. Can you tell the total probability with which they can achieve their task making sure they follow the rules of the tournament?
Input:
The first line contains two space separated integers N and K denoting the number of teams participating in the tournament and the number of teams against which Zulu's team definitely has to play respectively.
The second line contains K space separated integers denoting the list of K teams in the order Zulu's team are supposed to play against.
The next line contains an integer P denoting the number of teams that can be possible oppositions of Zulu's team in the beginning and the P space separated integers denoting the list of teams.
Each of the next N−1 lines contains an integer Q denoting the number of teams that can be possible oppositions of Zulu's team after they have played against the ith team and then Q space separated integers denoting the list of teams.
Output:
Output a single number denoting the total probability with which Zulu's team can achieve their task.
Your answer is considered correct, if it's absolute error does not exceed 10−6. Namely, let your answer be a and the jury's answer be b. Your answer is considered correct, if |a−b|≤10−6.
Constraints:
2≤N≤16
1≤K≤N−1
2≤Ti≤N
0≤P≤N−1
0≤Q≤N−2
In the given sample, there are three possible ways to play:
So the total probability would be (0.333333333)+(0.083333333)+(0.111111111)=0.527777778.