#Lutece2439. Ginkgo Tree
Ginkgo Tree
Migrated from Lutece 2439 Ginkgo Tree
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Ginkgo attracts a huge number of visitors to come to the Park of Electronic Science and Technology of China, though it's a kind of REALLY smelly tree. Kanade takes the responsibility of managing the main ginkgo tree, making the tree beautiful but not malodorous.
The main ginkgo tree in PESTC, Shahe is quite weird. Kanade knows that the tree consists of nodes and edges. The root of the tree is node . Each node has a beauty value, indicating its smelly level. When the beauty value of one node changes, all the nodes in its subtree whose distance to the node is a Fibonacci number changes the same. Formally, if the beauty value of node adds , all the nodes in the subtree of which adds . Where, refers to the set of Fibonacci numbers, refers to the edge number of the shortest path from to .
Sometimes Kanade will trim the tree, so she wants to know the sum of beauty value which holds , where is a node in the subtree of . But Kanade think it a really troublesome work. She's not actually going to trim the trees.
Kanade is busy with writing the report of Machine Learning and Its Application. Please help her.
Input
The first line of the input contains two integer , indicating the number of nodes and query.
The second line contains integer . The - th number indicates the beauty value of node at the beginning.
The third line contains integer . The - th number indicates the parent of .
The next lines, contains two or three integers, formatted as follows:
- : all the nodes in the subtree of which hold adds ;
- : output the sum of beauty value of the nodes in the subtree of which hold .
Output
For all query of type , output an integer in a line, indicating the answer.
Samples
6 5
1 1 4 5 1 4
5 2 1 4 2
1 1 4
2 1
1 2 2
1 5 -3
2 4
24
21
Constraints
$2\le n\le 2\times 10^5,1\le m\le 2\times 10^5, 1\le p_i,x\le n,1\le |a_i|,|y|\le 10^6$, and the can construct a tree.
Note
Please note that .
Resources
2020 第一次队内选拔赛 G