{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eYou ye Jiu yuan is the daughter of the Great GOD Emancipator. And when she becomes an adult, she will be queen of Tusikur, so she wanted to travel the world while she was still young. In a country, she found a small pub called Whitehouse. Just as she was about to go in for a drink, the boss Carola appeared. And ask her to solve this problem or she will not be allowed to enter the pub. The problem description is as follows:\u003c/p\u003e\u003cp\u003eThere is a tree with $n$ nodes, each node $i$ contains weight $a[i]$, the initial value of $a[i]$ is $0$. The root number of the tree is $1$. Now you need to do the following operations:\u003c/p\u003e\u003cp\u003e$1)$ Multiply all weight on the path from $u$ to $v$ by $x$\u003c/p\u003e\u003cp\u003e$2)$ For all weight on the path from $u$ to $v$, increasing $x$ to them\u003c/p\u003e\u003cp\u003e$3)$ For all weight on the path from $u$ to $v$, change them to the \u003cstrong\u003ebitwise NOT\u003c/strong\u003e of them\u003c/p\u003e\u003cp\u003e$4)$ Ask the sum of the weight on the path from $u$ to $v$\u003c/p\u003e\u003cp\u003eThe answer modulo $2^{64}$.\u003c/p\u003e\u003cp\u003eJiu Yuan is a clever girl, but she was not good at algorithm, so she hopes that you can help her solve this problem. Ding$\\backsim\\backsim\\backsim$\u003c/p\u003e\u003cp\u003eThe \u003cstrong\u003ebitwise NOT\u003c/strong\u003e is a unary operation that performs logical negation on each bit, forming the ones\u0027 complement of the given binary value. Bits that are $0$ become $1$, and those that are $1$ become $0$. For example:\u003c/p\u003e\u003cp\u003eNOT 0111 (decimal 7) \u003d 1000 (decimal 8) \u003c/p\u003e\u003cp\u003eNOT 10101011 \u003d 01010100\u003c/p\u003e\u003ch3\u003eInput\u003c/h3\u003e\u003cp\u003eThe input contains multiple groups of data.\u003c/p\u003e\u003cp\u003eFor each group of data, the first line contains a number of $n$, and the number of nodes.\u003c/p\u003e\u003cp\u003eThe second line contains $(n - 1)$ integers $b_i$, which means that the father node of node $(i +1)$ is $b_i$.\u003c/p\u003e\u003cp\u003eThe third line contains one integer $m$, which means the number of operations,\u003c/p\u003e\u003cp\u003eThe next $m$ lines contain the following four operations:\u003c/p\u003e\u003cp\u003eAt first, we input one integer opt\u003c/p\u003e\u003cp\u003e$1)$ If opt is $1$, then input $3$ integers, $u, v, x$, which means multiply all weight on the path from $u$ to $v$ by $x$\u003c/p\u003e\u003cp\u003e$2)$ If opt is $2$, then input $3$ integers, $u, v, x$, which means for all weight on the path from $u$ to $v$, increasing $x$ to them\u003c/p\u003e\u003cp\u003e$3)$ If opt is $3$, then input $2$ integers, $u, v$, which means for all weight on the path from $u$ to $v$, change them to the \u003cstrong\u003ebitwise NOT\u003c/strong\u003e of them\u003c/p\u003e\u003cp\u003e$4)$ If opt is $4$, then input $2$ integers, $u, v$, and ask the sum of the weights on the path from $u$ to $v$\u003c/p\u003e\u003cp\u003e$1 \\le n,m,u,v \\le 10^5$\u003c/p\u003e\u003cp\u003e$1 \\le x \u0026lt; 2^{64}$\u003c/p\u003e\u003ch3\u003eOutput\u003c/h3\u003e\u003cp\u003eFor each operation $4$, output the answer.\u003c/p\u003e"}},{"title":"Sample 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e7\n1 1 1 2 2 4\n5\n2 5 6 1\n1 1 6 2\n4 5 6\n3 5 2\n4 2 2\n2\n1\n4\n3 1 2\n4 1 2\n3 1 1\n4 1 1\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e5\n18446744073709551613\n18446744073709551614\n0\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr /\u003e"}}]}