2022 Fall Waterloo Local Contest, Problem C
Wesley creates a graph that contains
vertices. For each pair of vertices
, there is a probability
of
that an edge exists between
and
. The probabilities are independent of each other.
Let denote the number of triangles in
. A triangle is a set of
vertices that are connected by
edges.
Please help Wesley find the expected value of .
Input Specification
Line contains integer
, the number of cases.
lines follow. The
line contains integers
, separated by spaces.
Output Specification
Output lines, one line for each case.
Suppose the answer to the case is
, in lowest terms. Output
. That is, output
a number
such that
and
.
Sample Input
2
3 1 2
4 1 2
Sample Output
125000001
875000007
Note
The original problem did not have a sample.
Comments