{"raw_statement":[{"iden":"problem statement","content":"Given is an undirected graph with $N$ vertices and $M$ edges. The $i$\\-th edge connects Vertices $A_i$ and $B_i$ and has a weight of $C_i$.\nInitially, all vertices are painted black. You can do the following operation at most $K$ times.\n\n*   Operation: choose any vertex $v$ and any integer $x$. Paint red all vertices reachable from the vertex $v$ by traversing edges whose weights are at most $x$, including $v$ itself.\n\nHow many sets can be the set of vertices painted red after the operations?  \nFind the count modulo $998244353$."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 10^5$\n*   $0 \\leq M \\leq 10^5$\n*   $1 \\leq K \\leq 500$\n*   $1 \\leq A_i,B_i \\leq N$\n*   $1 \\leq C_i \\leq 10^9$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$ $K$\n$A_1$ $B_1$ $C_1$\n$\\vdots$\n$A_M$ $B_M$ $C_M$"},{"iden":"sample input 1","content":"3 2 1\n1 2 1\n2 3 2"},{"iden":"sample output 1","content":"6\n\nFor example, an operation with $(v,x)=(2,1)$ paints Vertices $1,2$ red, and an operation with $(v,x)=(1,0)$ paints Vertex $1$.\nAfter at most one operation, the set of vertices painted red can be one of the following six: ${},{1},{2},{3},{1,2},{1,2,3}$."},{"iden":"sample input 2","content":"5 0 2"},{"iden":"sample output 2","content":"16\n\nThe given graph may not be connected."},{"iden":"sample input 3","content":"6 8 2\n1 2 1\n2 3 2\n3 4 3\n4 5 1\n5 6 2\n6 1 3\n1 2 10\n1 1 100"},{"iden":"sample output 3","content":"40\n\nThe given graph may have multi-edges and self-loops."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}