Purring Junctions
Gats has tied strings along the edges of a tree with vertices, numbered .
Exactly cats are placed on distinct vertices. Their placement is chosen uniformly at random from all sets of vertices.
For a vertex , imagine removing and every edge incident to it. Each resulting connected component is called a branch of . A branch is occupied if it contains at least one cat.
A vertex purrs if both of the following conditions hold:
- Vertex does not contain a cat.
- Exactly branches of are occupied.
Each of the two occupied branches may contain any positive number of cats. Every other branch must contain no cats.
Let be the total number of purring vertices. Compute the expected value of modulo .
More precisely, let be the sum of over all possible placements. Output
where is the modular multiplicative inverse of modulo .
Input
The first line contains two integers and , where and .
Output
Print one integer satisfying , representing the expected number of purring vertices modulo .
Samples
Sample 1
Input
3 2 1 2 2 3
Output
333333336
There are equally likely placements. Only the placement makes a vertex purr, so the expectation is , represented modulo .