If it is not already visisted
if ( vis [ tree [ node ] [ child ] ] == 0 ) { ans += ( subtree_size [ tree [ node ] [ child ] ] * ( n - subtree_size [ tree [ node ] [ child ] ] ) ) ; ans = contribution ( tree [ node ] [ child ] , ans ) ; } } return ans ; }