Chino has n jingle bells, and she plans to decorate them on the Christmas tree one by one.
However,this Christmas tree is strange.This tree has n nodes,numbered from 1 to n.Each node has two value $a_i,b_i$. When Chino puts a jingle bell on node i, she will gain beauty value. Formally, after putting one jingle bell, let S be the set of nodes which contains at least one jingle bell, she will get $b_i\times \sum_{j\notin S} a_j$points.
At the beginning,Chino can only put bells on the root node of the Christmas tree and get 0 points.Then Chino can put jingle bells on any node v satisfying (u,v) ∈ E(G),u ∈ S,v $\notin$ S and get its beauty value. Chino want to make Christmas tree the most beautiful, but she don’t know the maximum beauty value she can get. Can you help her?