Knowledge-Oriented Problem

그래프를 k번 복사하고 연속한 복사본의 같은 정점끼리 연결한 그래프에서 신장 트리의 개수를 10^9+7로 나눈 나머지를 구한다.

어려움9그래프행렬수학분할 정복아직 제출이 없습니다시간 제한5초메모리 제한512 MB

문제

After gaining a lot of knowledge, you decided to write a knowledge-oriented problem.

You are given an undirected graph G with n vertices and m edges. You copy it k times and denote the copies by G1, G2, . . . , Gk. You add edges between vertex u in copy Gi and the same vertex u in copy Gi+1 for all 1 ≤ i ≤ k−1 and 1 ≤ u ≤ n.

Find the number of spanning trees of the new graph. The answer can be large, so output it modulo 109 + 7.

입력

The first line contains three integers n, m, k (1 ≤ n ≤ 500, 0 ≤ m ≤ n(n−1)/2, 1 ≤ k ≤ 1018).

Each of the following m lines contains two integers u, v (1 ≤ u, v ≤ n, u ≠ v) indicating an undirected edge (u, v) in the graph. All edges are distinct.

출력

Output one integer: the answer.