$Hazel$ would like to find out everything about the binary tree.
She has a **full** binary tree ,each point has different labels.
regarding each point of tree ,$Hazel$ defines its height $h_i$ being the number of points which the shortest path from this point to a leaf has.
each point has weight $A_i$ which be defined as $X^{h_i}$.
$Hazel$ wants to paint every points by color $B_i$,Observing the following rules:
$\bullet\ \forall i\in T,B_i\in N$
$\bullet\ \forall i\in T,B_i\ge B_{fa_i}$
$\bullet\ Y\ge 2\times \sum_{i\in leaf} B_i-\sum_{i\in T}B_i$
(define $B_{fa_{root}}=0$ )
$Hazel$ defines the contribution of the tree $S$ as $\sum_{i\in T}A_i\times B_i$.
She wants to know how many legal methods can she paint the tree,which cause $S$ is multiple of $P$.
You need to print $ans \ mod (10^9+7)$.