#include using std::cin; using std::cout; using std::endl; using std::vector; using ll=long long; //宣言、modpow const int mod=1e9+7; vector> edge,weight; vector dp,subtree,sum; vector flag; ll ans=0; ll modpow(ll x,ll y){ ll ret=1; while(y){ if(y&1){ ret*=x; ret%=mod; } x*=x; x%=mod; y/=2; } return ret; } //dfs void dfs(int now){ flag[now]=1; for(int i=0;i>N; edge.resize(N); weight.resize(N); dp.resize(N); subtree.resize(N,1); sum.resize(N); flag.resize(N); for(int i=1;i>x>>y>>z; edge[x-1].push_back(y-1); edge[y-1].push_back(x-1); weight[x-1].push_back(z); weight[y-1].push_back(z); } //求値、output dfs(0); reroot(0); ans*=modpow(2,mod-2); ans%=mod; cout<