Build Monuments
In the nation of Coderland, the layout of the cities can be depicted as a tree structure with totalCities numbered from 1 to totalCities. These cities are interconnected by totalCities - 1 two-way routes, where the i-th route links cityStart[i] with cityEnd[i].
The ruler of Coderland intends to install one of monumentTypes unique monuments in each city. However, the following condition must be satisfied:
Your task is to calculate the total number of valid configurations for placing monuments in every city based on these rules. Since the resulting number could be extremely large, return the answer modulo (10^9 + 7).
Two cities are regarded as adjacent if there is a direct connection between them via a route.
Parameters:
Returns:
1Example 1
