#include #define ll long long using namespace std; const ll mod=1000000007; const ll inv2=500000004; inline ll read(){ ll x=0;char ch=getchar(); while(!isdigit(ch)) ch=getchar(); while(isdigit(ch)) x=(x<<1)+(x<<3)+(ch^48),ch=getchar(); return x; } inline void write(ll x){ if(x==0){putchar('0');return;} // if(x<0){putchar('-');x=-x;} char ch[10];int cnt=0; while(x){ ch[cnt++]=(x%10)^48; x/=10; } while(cnt--) putchar(ch[cnt]); } inline ll poW(ll x,int y){ ll res=1; while(y){ if(y&1) res=res*x%mod; x=x*x%mod; y>>=1; } return res; } ll p1(int x){return x&1?mod-1:1;} ll fact[100005],inv[100005],ninv[100005]; int Z,t; int n,m; vector > g[100005]; int d[100005]; int a[100005]; int zz[100005]; int fa[100005]; vector vc; void dfs1(int v){ vc.push_back(v); for(auto e:g[v])if(e.first!=fa[v]){ fa[e.first]=v; if(zz[e.second]) a[e.first]=1; dfs1(e.first); } } ll dp[100005],ans; // void dfs2(int v,int fa){ // ll add=0; // ll sum=0,sum2=0; // if(a[v]) add=1; // for(auto e:g[v]){ // int to=e.first; // if(to==fa) continue; // dfs2(to,v); // dp[v]=(dp[v]+dp[to]*ninv[d[v]-1])%mod; // if(a[v]) add=(add+mod-dp[to]*ninv[d[v]-1]%mod)%mod; // sum=(sum+dp[to])%mod; // sum2=(sum2+dp[to]*dp[to])%mod; // } // dp[v]=(dp[v]+add)%mod; // ans=(ans+add)%mod; // ans=(ans+mod-(sum*sum%mod+mod-sum2)*inv2%mod*ninv[d[v]-1]%mod)%mod; // // cout<<"dp["<