### 题解

$$\sum_{S \in V} |f(S)|^m$$

$$\sum_{S \in V} \sum_{k=0}^m S_m^k C_{f(S)}^k k!$$

$$\sum_{k=0}^m S_m^k k! \sum_{S \in V} C_{f(S)}^k$$

$$\sum_{S \in V} C_{f(S)}^k$$

$$f[u][j+k][0] = f[u][j][0] * (f[v][k][0]+f[v][k][1])$$
$$f[u][j+k][1]=f[u][j][1]*(f[v][k][0]+f[v][k][1]+f[v][k-1][1])$$

#include<bits/stdc++.h>
#define Re register
#define fo(i, a, b) for (int i = (a); i <= (b); ++i)
#define fd(i, a, b) for (int i = (a); i >= (b); --i)
#define edge(i, u) for (Re int i = head[u], v = e[i].v; i; i = e[i].nxt, v = e[i].v)
#define pb push_back
#define F first
#define S second
#define ll long long
#define inf 1000000007
#define mp std::make_pair
#define mod 998244353
#define eps 1e-4
#define lowbit(x) (x & -x)
#define N 100005
#define ls (u << 1)
#define rs (u << 1 | 1)
#define cl(arr) memset(arr, 0, sizeof arr)
{
x = 0;
Re char ch = getchar();
while (!isdigit(ch)) ch = getchar();
while (isdigit(ch)) x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
}
int n, m, K;
struct edge {
int nxt, v;
} e[N << 1];
inline void addedge (int u, int v)
{
e[++tot] = (edge) { head[u], v };
}
ll f[N][12][2], g[12][2];
inline void dfs (int u, int fa)
{
f[u][0][0] = 0; f[u][0][1] = 1; //挑不挑自己
edge (i, u)
{
if (v == fa) continue;
dfs(v, u);
memcpy(g, f[u], sizeof g);
fo (j, 0, K) (g[j][0] += f[v][j][0] + f[v][j][1]) %= mod;
fo (j, 0, K)
fo (k, 0, K - j)
{
(g[j + k][0] += (f[v][k][0] + f[v][k][1]) * f[u][j][0]) %= mod;
if (k > 0)
(g[j + k][1] += (f[v][k][0] + f[v][k][1] + f[v][k - 1][1]) * f[u][j][1]) %= mod;
else
(g[j + k][1] += (f[v][k][0] + f[v][k][1]) * f[u][j][1]) %= mod;
}
memcpy(f[u], g, sizeof g);
}
}
ll s[15][15], fac[15], ans[15], sum;
int main ()
{
fo (i, 1, m)
{
int u, v;
}
dfs(1, 0);
fac[0] = 1; s[0][0] = 1;
fo (i, 1, K) fac[i] = fac[i - 1] * i % mod;
fo (i, 1, K)
fo (j, 1, i)
s[i][j] = (s[i - 1][j - 1] + s[i - 1][j] * j) % mod;
fo (i, 1, K) (sum += s[K][i] * fac[i] % mod * (f[1][i][0] + f[1][i][1]) % mod) % mod;
printf("%lld", sum);
return 0;
}