#P5789. [TJOI2017] 可乐(数据加强版)

[TJOI2017] 可乐(数据加强版)

Description

People on the planet Gariton especially like drinking cola. Therefore, their enemy planet developed a cola robot and placed it in City 11 on Gariton. This cola robot has three kinds of actions: stay where it is, go to the next adjacent city, and self-destruct. Every second it randomly triggers one action. Now you are given the city graph of Gariton. At time 00, the cola robot is in City 11. After tt seconds, how many possible action plans does the cola robot have?

Input Format

The first line contains two positive integers N,MN, M, where NN is the number of cities and MM is the number of roads.

The next MM lines each contain u,vu, v, meaning there is a bidirectional road between uu and vv.

Finally, input the time tt.

Output Format

Output the number of possible action plans of the cola robot. The answer may be very large, so output the result modulo 20172017.

3 2
1 2
2 3
2
8

Hint

Constraints

For 20%20\% of the data, n,m30n, m \leq 30, t1000t \leq 1000.

For 50%50\% of the data, t106t \leq 10^6.

For 100%100\% of the data, n,m100n, m \leq 100, t109t \leq 10^9.

Sample Explanation

11 \rightarrow explode.

11 \rightarrow 11 \rightarrow explode.

11 \rightarrow 22 \rightarrow explode.

11 \rightarrow 11 \rightarrow 11.

11 \rightarrow 11 \rightarrow 22.

11 \rightarrow 22 \rightarrow 11.

11 \rightarrow 22 \rightarrow 22.

11 \rightarrow 22 \rightarrow 33.

Translated by ChatGPT 5