#include using namespace std; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a struct Mint{ static constexpr T mod = MOD; T v; Mint():v(0){} Mint(signed v):v(v){} Mint(long long t){v=t%MOD;if(v<0) v+=MOD;} Mint pow(long long k){ Mint res(1),tmp(v); while(k){ if(k&1) res*=tmp; tmp*=tmp; k>>=1; } return res; } static Mint add_identity(){return Mint(0);} static Mint mul_identity(){return Mint(1);} Mint inv(){return pow(MOD-2);} Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;} Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;} Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;} Mint& operator/=(Mint a){return (*this)*=a.inv();} Mint operator+(Mint a) const{return Mint(v)+=a;} Mint operator-(Mint a) const{return Mint(v)-=a;} Mint operator*(Mint a) const{return Mint(v)*=a;} Mint operator/(Mint a) const{return Mint(v)/=a;} Mint operator-() const{return v?Mint(MOD-v):Mint(v);} bool operator==(const Mint a)const{return v==a.v;} bool operator!=(const Mint a)const{return v!=a.v;} bool operator <(const Mint a)const{return v constexpr T Mint::mod; template ostream& operator<<(ostream &os,Mint m){os< struct FixPoint : F{ FixPoint(F&& f):F(forward(f)){} template decltype(auto) operator()(Args&&... args) const{ return F::operator()(*this,forward(args)...); } }; template inline decltype(auto) MFP(F&& f){ return FixPoint{forward(f)}; } struct Centroid{ vector sz,dead; vector< vector > G; Centroid(){} Centroid(int n):sz(n,1),dead(n,0),G(n){} void add_edge(int u,int v){ G[u].emplace_back(v); G[v].emplace_back(u); } int dfs(int v,int p){ sz[v]=1; for(int u:G[v]) if(u!=p&&!dead[u]) sz[v]+=dfs(u,v); return sz[v]; } void find(int v,int p,int tmp,vector &cs) { int ok=1; for (int u:G[v]){ if(u==p||dead[u]) continue; find(u,v,tmp,cs); ok&=(sz[u]<=tmp/2); } ok&=(tmp-sz[v]<=tmp/2); if(ok) cs.emplace_back(v); } vector build(int r) { int tmp=dfs(r,-1); vector cs; find(r,-1,tmp,cs); return cs; } const vector& operator[](int k)const{return G[k];} void disable(int v){dead[v]=1;} void enable(int v){dead[v]=0;} int alive(int v){return !dead[v];} }; namespace FFT{ using dbl = double; struct num{ dbl x,y; num(){x=y=0;} num(dbl x,dbl y):x(x),y(y){} }; inline num operator+(num a,num b){ return num(a.x+b.x,a.y+b.y); } inline num operator-(num a,num b){ return num(a.x-b.x,a.y-b.y); } inline num operator*(num a,num b){ return num(a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x); } inline num conj(num a){ return num(a.x,-a.y); } int base=1; vector rts={{0,0},{1,0}}; vector rev={0,1}; const dbl PI=asinl(1)*2; void ensure_base(int nbase){ if(nbase<=base) return; rev.resize(1<>1]>>1)+((i&1)<<(nbase-1)); rts.resize(1< &as){ int n=as.size(); assert((n&(n-1))==0); int zeros=__builtin_ctz(n); ensure_base(zeros); int shift=base-zeros; for(int i=0;i>shift)) swap(as[i],as[rev[i]>>shift]); for(int k=1;k vector multiply(vector &as,vector &bs){ int need=as.size()+bs.size()-1; int nbase=0; while((1< fa(sz); for(int i=0;i>1);i++){ int j=(sz-i)&(sz-1); num z=(fa[j]*fa[j]-conj(fa[i]*fa[i]))*r; if(i!=j) fa[j]=(fa[i]*fa[i]-conj(fa[j]*fa[j]))*r; fa[i]=z; } fft(fa); vector res(need); for(int i=0;i; M calc(vector> H){ int n=H.size(); Centroid G(n); G.G=H; queue que; que.emplace(G.build(0)[0]); using ll = long long; vector ans(n,0); while(!que.empty()){ int r=que.front();que.pop(); vector cnt; cnt.emplace_back(1); for(int c:G[r]){ if(!G.alive(c)) continue; vector num; MFP([&](auto dfs,int v,int p,int d)->void{ while((int)cnt.size()<=d) cnt.emplace_back(0); while((int)num.size()<=d) num.emplace_back(0); cnt[d]++; num[d]++; for(int u:G[v]){ if(u==p or !G.alive(u)) continue; dfs(u,v,d+1); } })(c,r,1); auto ns=FFT::multiply(num,num); for(int i=0;i>n; vector> G(n); for(int i=1;i>a>>b; a--;b--; G[a].emplace_back(b); G[b].emplace_back(a); } const M inv2=M(2).inv(); M ans{0}; vector dp1(n),dp2(n); // 3 points (distinct) MFP([&](auto dfs,int v,int p)->void{ vector cur(4,0); cur[0]=M(1); cur[1]=M(1); for(int u:G[v]){ if(u==p) continue; dfs(u,v); vector nxt(4,0); nxt[0]+=cur[0]; nxt[1]+=cur[0]*dp1[u]; nxt[2]+=cur[0]*dp2[u]*inv2; nxt[1]+=cur[1]; nxt[2]+=cur[1]*dp1[u]; nxt[3]+=cur[1]*dp2[u]*inv2; nxt[2]+=cur[2]; nxt[3]+=cur[2]*dp1[u]; nxt[3]+=cur[3]; swap(cur,nxt); } dp1[v]=cur[1]*M(1)*inv2; dp2[v]=cur[2]*M(2)*inv2; ans+=cur[3]*M(6); })(0,-1); ans*=M(2).pow(n-1); ans+=calc(G); cout<