as know undirecte connect graph n node n1 edge call tree you give integer d tree consist n node each node value ai associate itWe set S tree nod valid follow condition satisfy S nonempty S connect in word nod u v S node lie simple path u v present S your task count number valid set since result large print remainder modulo 1000000007 1097