Codeforces Round 630 (Div. 2)
F
Independent Set
Codeforces
2500
原题
← EG →
翻译中…

Eric is the teacher of graph theory class. Today, Eric teaches independent set and edge-induced subgraph.

翻译中…

Given a graph $G=(V,E)$, an independent set is a subset of vertices $V' \subset V$ such that for every pair $u,v \in V'$, $(u,v) \not \in E$ (i.e. no edge in $E$ connects two vertices from $V'$).

翻译中…

An edge-induced subgraph consists of a subset of edges $E' \subset E$ and all the vertices in the original graph that are incident on at least one edge in the subgraph.

翻译中…

Given $E' \subset E$, denote $G[E']$ the edge-induced subgraph such that $E'$ is the edge set of the subgraph. Here is an illustration of those definitions:

翻译中…

image

翻译中…

In order to help his students get familiar with those definitions, he leaves the following problem as an exercise:

翻译中…

Given a tree $G=(V,E)$, calculate the sum of $w(H)$ over all except null edge-induced subgraph $H$ of $G$, where $w(H)$ is the number of independent sets in $H$. Formally, calculate $\sum \limits_{\emptyset \not= E' \subset E} w(G[E'])$.

翻译中…

Show Eric that you are smarter than his students by providing the correct answer as quickly as possible. Note that the answer might be large, you should output the answer modulo $998,244,353$.

翻译中…

Input

翻译中…

The first line contains a single integer $n$ ($2 \le n \le 3 \cdot 10^5$), representing the number of vertices of the graph $G$.

翻译中…

Each of the following $n-1$ lines contains two integers $u$ and $v$ ($1 \le u,v \le n$, $u \not= v$), describing edges of the given tree.

翻译中…

It is guaranteed that the given edges form a tree.

翻译中…

Output

翻译中…

Output one integer, representing the desired value modulo $998,244,353$.

翻译中…

Note

翻译中…

For the second example, all independent sets are listed below.

翻译中…

image

翻译中…

样例

Input #1
2
2 1
Output #1
3
InputCopy OutputCopy
Input #2
3
1 2
3 2
Output #2
11
InputCopy OutputCopy
题目信息
题号
1332F
时间限制
2 s
内存限制
512 MB
标签
DFS 及类似
动态规划
树

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。