int n,u[3d5],v[2d5];{rd(n,(u,v)(n-1));graph g;g.setEdge(n+1,n-1,u,v);g.getDist(1,u);Mint r;r-=Mint(1)/~u[1..n];r*=(1..n);wt(r);}