Little Q is crazy about graph theory, and now he creates a game about graphs and trees.
There is a bi-directional graph with $n$ nodes, labeled from 0 to $n-1$. Every edge has its length, which is a positive integer ranged from 1 to 9.
Now, Little Q wants to delete some edges (or delete nothing) in the graph to get a new graph, which satisfies the following requirements:
(1) The new graph is a tree with $n-1$ edges.
(2) For every vertice $v(0<v<n)$, the distance between 0 and $v$ on the tree is equal to the length of shortest path from 0 to $v$ in the original graph.
Little Q wonders the number of ways to delete edges to get such a satisfied graph. If there exists an edge between two nodes $i$ and $j$, while in another graph there isn't such edge, then we regard the two graphs different.
Since the answer may be very large, please print the answer modulo $10^9+7$.