- Time limit: 1.00 s
- Memory limit: 512 MB
You are given a rooted tree consisting of nodes. The nodes are numbered , and node is the root. Each node has a value.
Your task is to process following types of queries:
- change the value of node to
- calculate the sum of values in the subtree of node
Input
The first input line contains two integers and : the number of nodes and queries. The nodes are numbered .
The next line has integers : the value of each node.
Then there are lines describing the edges. Each line contans two integers and : there is an edge between nodes and .
Finally, there are lines describing the queries. Each query is either of the form "1 " or "2 ".
Output
Print the answer to each query of type 2.
Constraints
Example
Input:
5 3 4 2 5 2 1 1 2 1 3 3 4 3 5 2 3 1 5 3 2 3
Output:
8 10