Professor Zhang has an undirected graph G with n vertices and m edges. Each vertex has an integer weight w_i. Let G_i be the graph obtained by deleting the i-th vertex from graph G. Professor Zhang wants to find the weights of G_1,G_2,…,G_n.
The weight of a graph G is defined as follows:
A connected component H of an undirected graph G is a subgraph in which any two vertices are connected by a path, and no other vertex in G is connected to any vertex from H by a path.
There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:
The first line contains two integers n and m (2≤n≤105, 1≤m≤2⋅105): the number of vertices and the number of edges.
The second line contains n integers w_1,w_2,…,w_n (1≤w_i≤109) denoting the weight of each vertex.
Each of the next m lines contains two integers x_i and y_i (1≤x_i,y_i≤n, x_i=y_i) denoting an undirected edge.
There are at most 1000 test cases, the sum of n in all the test cases is at most 1.5⋅106, and the sum of m in all the test cases is also at most 1.5⋅106.
For each test case, output the integer S=(∑_i=1ni⋅z_i) modulo 109+7, where z_i is the weight of G_i.