Problem: We have a tree G with N vertices numbered 1 to N. The i-th edge of G connects Vertex a_i and Vertex b_i.

Consider adding zero or more edges in G, and let H be the graph resulted.

Find the number of graphs H that satisfy the following conditions, modulo 998244353.

* H does not contain self-loops or multiple edges.
* The diameters of G and H are equal.
* For every pair of vertices in H that is not directly connected by an edge, the addition of an edge directly connecting them would reduce the diameter of the graph.

Constraints

* 3 \le N \le 2 \times 10^5
* 1 \le a_i, b_i \le N
* The given graph is a tree.

Input

Input is given from Standard Input in the following format:


N
a_1 b_1
\vdots
a_{N-1} b_{N-1}


Output

Print the answer.

Examples

Input

6
1 6
2 1
5 2
3 4
2 3


Output

3


Input

3
1 2
2 3


Output

1


Input

9
1 2
2 3
4 2
1 7
6 1
2 5
5 9
6 8


Output

27


Input

19
2 4
15 8
1 16
1 3
12 19
1 18
7 11
11 15
12 9
1 6
7 14
18 2
13 12
13 5
16 13
7 1
11 10
7 17


Output

78732

Solution (in CPP):

Solution:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;
#define N 200020
const int mod=998244353;
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,dep[N],root,f[N],L,dp[N][3][3];
vector<int> G[N],D;
void init(int u,int fa){
	dep[u]=dep[fa]+1;
	f[u]=fa;
	if(dep[u]>L){
		L=dep[u],root=u;
	}
	for(auto v:G[u]){
		if(v==fa)continue;
		init(v,u);
	}
}
void dfs(int u,int fa,int dep){
	if(dep==(D.size()-1)/2){
		dp[u][1][1]=1;
	}
	else{
		dp[u][0][0]=1;
	}
	for(auto v:G[u]){
		if(v==fa)continue;
		dfs(v,u,dep+1);
		static int g[3][3];
		memset(g,0,sizeof(g));
		for(int i=0;i<3;++i){
			for(int j=0;j<3;++j){
				for(int x=0;x<3;++x){
					for(int y=0;y<3;++y){
						for(int k=0;k<3;++k){
							int a=min(2,i+x*(k==1));
							int b=min(2,j+y*(k==2));
							g[a][b]=(g[a][b]+1LL*dp[u][i][j]*dp[v][x][y])%mod;
						}
					}
				}
			}
		}
		memcpy(dp[u],g,sizeof(dp[u]));
	}
}
int main(){
	n=read();
	for(int i=1;i<n;++i){
		int u=read(),v=read();
		G[u].push_back(v);
		G[v].push_back(u);
	}
	init(1,0);
	L=0;
	init(root,0);
	for(int u=root;u;u=f[u]){
		D.push_back(u);
	}
	if(D.size()&1){
		int x=D[D.size()>>1];
		dfs(x,0,0);
		printf("%lld\n",1LL*dp[x][1][1]*((mod+1)/2)%mod);
	}
	else{
		int x=D[(D.size()>>1)-1],y=D[D.size()>>1];
		dfs(x,y,0),dfs(y,x,0);
		printf("%lld\n",(1LL*dp[x][1][0]+dp[x][1][1]+dp[x][1][2])*(1LL*dp[y][0][1]+dp[y][1][1]+dp[y][2][1])%mod);
	}
	return 0;
}