#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 nn nodes and n1n-1 edges. The root of the tree is node 11. 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 xx adds yy, all the nodes zz in the subtree of xx which d(x,z)fd(x,z)\in f adds yy. Where, ff refers to the set of Fibonacci numbers, d(x,y)d(x,y) refers to the edge number of the shortest path from xx to yy.

Sometimes Kanade will trim the tree, so she wants to know the sum of beauty value which holds d(x,z)fd(x,z)\in f, where zz is a node in the subtree of xx. 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 n,mn,m, indicating the number of nodes and query.

The second line contains nn integer aia_i. The ii - th number indicates the beauty value of node ii at the beginning.

The third line contains n1n-1 integer pip_i. The ii - th number indicates the parent of i+1i+1.

The next mm lines, contains two or three integers, formatted as follows:

  • 1 x y\texttt{1 x y}: all the nodes in the subtree of xx which hold d(x,i)fd(x,i)\in f adds yy;
  • 2 x\texttt{2 x}: output the sum of beauty value of the nodes in the subtree of xx which hold d(x,i)fd(x,i)\in f.

Output

For all query of type 22, 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 pip_i can construct a tree.

Note

Please note that 0f0\in f.

Resources

2020 第一次队内选拔赛 G