You are given a rooted tree with $$$n$$$ nodes, where the root is node $$$1$$$. Each node of the tree is labeled with a lowercase English letter.
You need to count the number of valid 5-tuples of nodes $$$(u_1, u_2, u_3, u_4, u_5)$$$ that satisfy the following conditions. The answer should be computed modulo $$$998244353$$$.
The first line contains a single positive integer $$$n$$$ $$$(1 \leq n \leq 5 \times 10^5)$$$, denoting the number of nodes in the tree. The second line contains a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters, where $$$s_i$$$ denotes the letter on node $$$i$$$. The third line contains $$$n-1$$$ positive integers $$$fa_2, fa_3, \dots, fa_n$$$, where the $$$i$$$-th integer represents the parent of node $$$(i+1)$$$. It is guaranteed that $$$1 \leq fa_i \lt i$$$.
Print a single integer representing the number of valid 5-tuples modulo $$$998244353$$$.
5cbdae1 1 2 3
1
5cbdea1 1 2 3
0
8ccdbdeae1 1 2 2 3 4 5
2
9ccdbdfaee1 1 2 2 3 4 5 6
2