There are multiple test cases.
The first line of the input contains an integer $T$, the number of test cases.
Each test case begins with 3 positive integers$n(1\leq n\leq 15),m(1\leq M\leq 100,L(1\leq L\leq 20000)$, which are described above.
The next line will contain m positive integers $a_1,a_2,\cdots ,a_m$, which describes probability distribution of the dice. This means, the machine will generate 1 with probability $\frac{a_1}{(a_1+a_2+\cdots +a_m)}$ , 2 with probability $\frac{a_2}{(a_1+a_2+\cdots +a_m)}$, and so on. The total sum of $a_i$ does not exceeds 1000000000.
Each of the next $n$ lines contains a sequence of length $L$.
The total sum of $n\times L$ over all test cases will not exceed 777777.