Little Y is a Riddler. He always says that this is a secret.
One day, he got a undirected tree. He met Jessica and say, “Hey! I’ve got a new tree. Do you want to guess? This is a secret.”
- The depth of node $i$ in the tree is $d_i$.
- The position of $i$ in the BFS sequence of tree should be less than or equal to $x_i$.
- If $x$ is before $y$ in BFS sequence, either the parent node of $x$ is also the parent node of $y$, or the parent node of $x$ is before the parent node of $y$ in BFS sequence.
However, Jessica quickly finds that too many trees satisfy his conditions. To give him a lesson, she wants to figure out the number of the trees satisfying all these restrictions. Can you help her?