You are given a rooted tree on n vertices numbered from 1 to n. The root of the tree is vertex 1, and for each vertex i (i≥2), its parent is vertex p_i.
Consider a permutation q_i (1≤i≤n). We will call this permutation proper if, for any vertex v, all its descendants are located to the right of the position of v in permutation q.
You are asked to find the number of proper permutations q_i such that q_k=v, taken modulo 109+7.
The first line of the input contains a single integer n (1≤n≤5000), the number of vertices in the tree.
The second line contains n−1 integers p_2,p_3,…,p_n (1≤p_i<i), the parents of all vertices in the tree except the root. In particular, when n=1, the second line is present but empty.
The last line contains two integers v and k (1≤v,k≤n).
Output one integer: the remainder of the number of proper permutations q_i with q_k=v modulo 109+7.
The valid proper permutations for the sample case are:
132456, 132465, 132546, 132564, 132645, 132654, 142356, 142365, 142536.