Independent Set

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:

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$.

Examples

input

2
2 1

output

3

input

3
1 2
3 2

output

11

Note

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

Solution:

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod=998244353;
const ll mod2=mod*mod;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int N=301000;
VI e[N];
ll dp[N][2][3],tmp[10][10];
int n;

void upd(ll &a,ll b) {
a+=b; if (a>=mod2) a-=mod2;
}

void dfs(int u,int f) {
dp[u][0][0]=1;
dp[u][0][1]=1;
dp[u][0][2]=1;
for (auto v:e[u]) {
if (v==f) continue;
dfs(v,u);
for (int p=0;p<=1;p++) for (int q=0;q<=2;q++) tmp[p][q]=0;
		for (int p=0;p<=1;p++) for (int q=0;q<=2;q++) if (dp[u][p][q])
			for (int r=0;r<=1;r++) for (int s=0;s<=2;s++) for (int cc=0;cc<=1;cc++) {
				if (r==0&&s>=1&&cc==0) continue;
if (cc==0) {
upd(tmp[p][q],dp[u][p][q]*dp[v][r][s]);
} else {
if (q==2&&s==2) continue;
if (q==0||s==0) continue;
upd(tmp[1][q],dp[u][p][q]*dp[v][r][s]);
}
}
for (int p=0;p<=1;p++) for (int q=0;q<=2;q++) dp[u][p][q]=tmp[p][q]%mod;
	}
	//for (int p=0;p<=1;p++) for (int q=0;q<=2;q++) printf("u : %d p : %d q : %d dp : %lld\n",u,p,q,dp[u][p][q]);
}

int main() {
	scanf("%d",&n);
	for (int i=1;i<n;i++) {
		int u,v;
		scanf("%d%d",&u,&v);
		e[u].pb(v);
		e[v].pb(u);
	}
	dfs(1,0);
	ll ans=mod-1;
	for (int p=0;p<=1;p++) for (int q=0;q<=2;q++) {
		if (p==0&&q>=1) continue;
upd(ans,dp[1][p][q]);
}
ans%=mod;
printf("%lld\n",ans);
}