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
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<ll,ll>
#define poly vector<ll>
#define mem(a) memset((a),0,sizeof(a))
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
#define SZ(x) ((int)(x.size()))
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
ll rnd(){
	ull ans=0;
	For(i,0,4)ans=ans<<15^rand();
	return ans%((ull)1<<63);
}
const int N=200005,mod=998244353;
int n,rt,dep[N],mx[N],fa[N];
ll dp[N][3],jb[3];
vector<int> v[N];
inline void add(ll &a,ll b){
	a=(a+b)%mod;
}
void dfs(int p){
	dep[p]=dep[fa[p]]+1;
	if(dep[p]>dep[rt])rt=p;
	for(auto i:v[p])if(i!=fa[p]){
		fa[i]=p; dfs(i);
	}
}
void solve(int rt,int fa){
	dp[rt][v[rt].size()==1]=1;
	for(auto i:v[rt])if(i!=fa){
		solve(i,rt); mx[rt]=max(mx[rt],mx[i]+1);
	}
	for(auto i:v[rt])if(i!=fa){//分别表示 几个满的 
		if(mx[i]+1!=mx[rt]){
			dp[i][0]+=dp[i][1]+dp[i][2]; dp[i][1]=dp[i][2]=0;
		}
		mem(jb);
		Rep(j,2,0){
			Rep(k,2,0)add(jb[min(2,j+k)],dp[rt][j]*dp[i][k]);
		}
		swap(jb,dp[rt]);
	}
	dp[rt][0]=(dp[rt][0]*3+dp[rt][1]*2+dp[rt][2]*2)%mod;
}
int main(){
	#ifdef Brollan
		freopen("std.in","r",stdin);
	#endif
	n=read(); 
	For(i,1,n-1){
		int s=read(),t=read();
		v[s].pb(t); v[t].pb(s);
	}
	
	dfs(1);
	int t=rt; rt=0; fa[t]=0;
	dfs(t);
	int len=dep[rt];//cerr<<t<<" "<<rt<<" "<<dep[rt]<<endl;
	For(j,1,(len-1)/2)rt=fa[rt];
	if(len%2==0){
		int A=rt,B=fa[rt];
		//cout<<A<<" "<<B<<endl;
		solve(A,B);
		solve(B,A);
		cout<<dp[A][1]*dp[B][1]%mod<<endl;
	}else{
		dp[rt][0]=1;
		for(auto i:v[rt]){
			solve(i,rt); 
			if(mx[i]+1<len/2){dp[i][0]+=dp[i][1]+dp[i][2]; dp[i][1]=dp[i][2]=0;}
			else dp[i][0]+=mod-dp[i][1]+mod-dp[i][2];
			//cout<<dp[i][1]<<" "<<dp[i][0]%mod<<" "<<dp[rt][1]<<endl;
			mem(jb);
			Rep(j,2,0)Rep(k,1,0){
				if(j+k<=2)add(jb[j+k],dp[rt][j]*dp[i][k]);
			}
			swap(jb,dp[rt]);
		}
		cout<<dp[rt][2]<<endl;
	}
}