Problem Description
There are n islands in the world Lotus lives.Each island has a probability pi and a list consists of some other islands.
Lotus came to island 1 at first.She will repeat the following operations:
1、Assume Lotus is in island x,there is a probability of px that produces an undirected edge connecting two random islands.The two islands will not be the same, nor will they already be connected by an edge.
2、Lotus will leave contentedly if all the islands have been connected.
3、Otherwise,she will choose an random island from the current island's list and go there.Her dissatisfied value will be increased by 1.
Lotus wants you to calculate the expected value of her dissatisfied value.
The pi is given in the prime field of integers modulo 109+7.You should output the answer modulo 109+7,too.
Input
First line a integer T(0≤T≤10) denoting the number of test cases.
For each test case,first line is an integer n(1≤n≤30),in the second line there are n integers denoting pi.Each of the next n lines contains an integer x followed by x integers describing the island's list.
It is guaranteed that for each island,its list doesn't contain two same islands,nor do itself.
Output
For each test case,output one line containing a single integer,denoting the answer modulo 109+7.
Sample Input
1
2
500000004 1
1 2
1 1
Sample Output
500000004