#include #include #include using mint = atcoder::modint998244353; namespace atcoder { std::istream& operator>>(std::istream& in, mint &a) { long long e; in >> e; a = e; return in; } std::ostream& operator<<(std::ostream& out, const mint &a) { out << a.val(); return out; } } // namespace atcoder int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; std::cin >> n; std::vector> g(n); for (int i = 0; i < n - 1; ++i) { int u, v; std::cin >> u >> v; --u, --v; g[u].push_back(v); g[v].push_back(u); } const mint m = n * (n + 1) / 2; mint ans = 1; auto dfs = [&](auto dfs, int u, int p) -> long long { mint P_u = m; long long subu = 1; for (int v : g[u]) if (v != p) { long long subv = dfs(dfs, v, u); P_u -= subv * (subv + 1) / 2; mint P_uv = mint(subv) * (n - subv); ans -= P_uv / (m - P_uv); subu += subv; } if (p != -1) { long long subp = n - subu; P_u -= subp * (subp + 1) / 2; } ans += P_u / (m - P_u); return subu; }; dfs(dfs, 0, -1); std::cout << ans.val() << std::endl; }