Given a tree with $n$ nodes, let node $1$ be the root. Each edge has a weight of $1$. Each node $x$ has a weight $a_x$, initially $0$ for all nodes. There are $m$ operations. Each operation starts with an operation type $\text{opt}$, followed by its parameters:
- Given a path $(x, y)$, a range $k$, and a value $u$: for all nodes $i$ such that the shortest distance from $i$ to the path $(x, y)$ is $\le k$, update $a_i \gets a_i + u$.
- Given a node $x$ and a value $u$: for all nodes $i$ in the subtree of $x$, update $a_i \gets a_i + u$.
- Given a path $(x, y)$ and a range $k$: for all nodes $i$ such that the shortest distance from $i$ to the path $(x, y)$ is $\le k$, query the sum of weights $a_i$ for all such nodes $i$.
- Given a node $x$: for all nodes $i$ in the subtree of $x$, query the sum of weights $a_i$ for all such nodes $i$.
- Given a path $(x, y)$ and a range $k$: for all nodes $i$ such that the shortest distance from $i$ to the path $(x, y)$ is $\le k$, query the maximum weight $a_i$ among all such nodes $i$.
- Given a node $x$: for all nodes $i$ in the subtree of $x$, query the maximum weight $a_i$ among all such nodes $i$.
The operation numbers correspond to the types above, and the parameters are provided in the order described.
Input
The first line contains two positive integers $n$ and $m$, representing the size of the tree and the number of operations.
The next $n-1$ lines each contain two positive integers $u, v$, representing an edge $(u, v)$ in the tree.
The next $m$ lines each start with an integer $\text{opt}$, representing the operation type:
- If $\text{opt} = 1$, then $x, y, k, u$ follow.
- If $\text{opt} = 2$, then $x, u$ follow.
- If $\text{opt} = 3$, then $x, y, k$ follow.
- If $\text{opt} = 4$, then $x$ follows.
- If $\text{opt} = 5$, then $x, y, k$ follow.
- If $\text{opt} = 6$, then $x$ follows.
Output
Output several lines, providing the answer for each operation of type 3, 4, 5, or 6.
Constraints
This problem uses subtask evaluation, with dependencies between subtasks.
- Subtasks 1 and 2 (10 points + 10 points): $k = 0$ is guaranteed.
- Subtasks 3 and 4 (10 points + 10 points): All operations involving a path $(x, y)$ satisfy $x = y$.
- Subtasks 5 and 6 (10 points + 10 points): $k = 1$ is guaranteed.
- Subtasks 7 and 8 (20 points + 20 points): No special restrictions.
All odd-numbered subtasks do not include operations 5 and 6.
For all data, $1 \le n, m \le 2 \times 10^5$, $0 \le k \le 3$, and $-10^5 \le u \le 10^5$.