B. Aho-Corasick Automaton
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output

Little A has many strings, each with a character set of $$$\{1,2,\cdots,m\}$$$. He constructed a Trie for these strings and built an Aho-Corasick automaton from this Trie.

However, due to Little A's negligence, both the original strings and the constructed Aho-Corasick automaton have disappeared. Little A only remembers that the lengths of all original strings do not exceed $$$d$$$, and that the constructed Aho-Corasick automaton has $$$n$$$ vertices and a character set of $$$\{1,2,\cdots,m\}$$$.

Now, Little A wants to know how many different Aho-Corasick automatons could possibly be the one he constructed. Since the answer can be large, you only need to find the result modulo $$$998244353$$$.

The Aho-Corasick automaton is defined as follows:

  1. A Trie $$$T$$$ is a rooted tree without labels, where each edge is labeled with a character. A vertex $$$x$$$ in the Trie cannot have two child vertices $$$y$$$ and $$$z$$$ such that the edges $$$(x, y)$$$ and $$$(x, z)$$$ are labeled with the same character.
  2. Given a Trie $$$T$$$ with root $$$r$$$, for a vertex $$$x$$$, the string represented by $$$x$$$ is the concatenation of the characters on the edges from $$$r$$$ to $$$x$$$. In particular, the string represented by $$$r$$$ is the empty string. It can be proven that no two different vertices represent the same string.
  3. We say that a string $$$S$$$ exists in Trie $$$T$$$ if and only if there exists a vertex $$$x$$$ such that the string represented by $$$x$$$ is $$$S$$$.
  4. Constructing a Trie $$$T$$$ for some strings $$$S_1,S_2,\cdots,S_k$$$ means finding a Trie $$$T$$$ with the minimum number of vertices such that all strings $$$S_i$$$ exist in Trie $$$T$$$. It can be proven that such a Trie is unique when unlabeled.
  5. The fail tree $$$F$$$ of Trie $$$T$$$ is a tree with root $$$r$$$. Define $$$S_x$$$ as the string represented by vertex $$$x$$$. For a non-root vertex $$$x$$$, let $$$U$$$ be the longest proper suffix of $$$S_x$$$ (a proper suffix is one that is not equal to $$$S_x$$$) such that $$$U$$$ exists in $$$T$$$. Then, $$$fail_x$$$ is defined as the vertex such that $$$S_{fail_x} = U$$$. Note that the empty suffix of $$$S_x$$$ always exists in $$$T$$$, so $$$fail_x$$$ always exists. The edge set of $$$F$$$ is $$$\{(x, fail_x) | x \in [1, n], x \neq r\}$$$. It can be proven that these edges form a tree.
  6. Merging Trie $$$T$$$ and its fail tree $$$F$$$ means that the vertex set remains unchanged (the vertex sets of $$$T$$$ and $$$F$$$ are the same), and the edges and the characters on the edges are merged to obtain the graph, which is the Aho-Corasick automaton $$$A$$$ of Trie $$$T$$$. At this point, $$$A$$$ contains both edges labeled with characters and edges without labels.

Two Aho-Corasick automatons are considered the same if and only if they have the same number of vertices and there exist two labeling schemes for the vertices (let's assume they are two permutations of length equal to the number of vertices) such that:

  1. The roots of the two Aho-Corasick automatons are the same.
  2. For any pair of vertices $$$x,y$$$, either there is no edge between $$$x$$$ and $$$y$$$ in both Aho-Corasick automatons, or there is an edge in both and the characters on the edges are the same, or both edges do not have labels.
Input

A single line containing three integers $$$n,m,d$$$ ($$$1\leq n,m,d\leq 100$$$), representing the number of vertices in the Aho-Corasick automaton, the size of the character set, and the upper limit on the lengths of all strings.

Output

A single line containing an integer representing the answer.

Example
Input
3 2 2
Output
5